views:

494

answers:

2

I have a program that I want to use as an autorun. I want it to be able to do three things. It needs to check to see if a specific program is installed, if it is not, present the user with the option to install it. Second, if the program is installed, present the user with the option of running it and uninstalling it, third, present the user the option to view a readme.

How can I get a program to check and see if another program is already installed? How can I launch an installer/uninstaller from another program?

Thanks.

P.S. I can modify the installer.

A: 

Assuming your installation is Windows Installer based, everything you need is here.

On Freund
I have no idea how to use that to tell if a program is already installed or not.
Malfist
You can use the MsiEnumProductsEx function and pass it the product code for the program you're interested in.
On Freund
MsiQueryProductState also seems to does the trick
On Freund
+1  A: 

Assuming its your program and you're building the install, I'd just have your installer write to a registry key and then check that key in your autorun program.

To launch the installer from your autorun program just run the setup.exe, or use MSIEXEC for an MSI.

sascha
That's just reinventing the wheel. Why not use an existing supported mechanism?
On Freund
It's simpler, works for non-MSI installers and I wouldn't consider reading a registry key "unsupported" ;)
sascha