09-01-2008 07:08 AM
09-01-2008 02:57 PM - edited 09-01-2008 02:58 PM
When a program is installed information as to its installation path is (usually) written to the registry. One place that you can find this information is in the HKLM/Software hierarchy. When your program gets installed a new key (folder) should be created in that tree. Sometimes you'll find a "Path" key within this subtree. Sometimes the path is stored in the "Default" key for that subtree. The only way to tell is to actually look.
Another location where this information can be found is in the HKCR\Applications hierarchy. Each application has its own subtree. There you will have a shell\open\command and the "Default" value will provide the full path to the application. Attached is a screenshot of what my registry looks like for, say, Firefox. If I wanted to read this registry value in LabVIEW I would do this:
09-02-2008 03:43 AM
Hi there
if i'd be the user it would be OK for me to manually supply the path to the desired application, e.g. by a file dialog (i do similar things each time i configure e.g. web browsers, mail clients, IDEs etc..). If the LV app stores the path in a file it would ask me only once.
just in case the folder of the app is in the systems search path you do not have to supply the full path of the app to run it.
09-02-2008 03:58 AM
There's on more location in the registry where you could look:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\<Appname>. If the application is listed there you'll find the path in the default key.
09-03-2008 04:21 AM
Hi Dylan,
What everyone is saying would seem to be the way to go either:
1) Read the location from the registry if it creates a registry key on installation.
2) If not then creating a one off prompt where they select the location of the executable and then save this information to a configuration file. You could perhaps automatically set the expected location (presumably c:\Program Files ...) and if it isnt found there then prompt the user.
Regards,
09-03-2008 05:20 AM
Thanks to you all for your help, I have searched the registry carefully, but I do not think the program does create an entry there which means I cannot find it there. I think the best option is to look initially in its expected location and if not found open a dialogue box for the user to locate the software. Thanks again for your help.