Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Open With dialog
Message
From
25/01/1999 22:56:20
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00180046
Message ID:
00180141
Views:
21
>I want to be able to start an application based on a given file extension. Can some one tell me if there is an API function that will return the associated exe name if I pass it an extension. Also, if there is not an associated exe then I want to be able to open the "Open With" dialog so the user can set up a file extension to exe association.

Dennis- George is much more qualified than myself to answer your question, but I thought I might throw a couple of tidbits at you-

The Win API function Shellexecute does automatically what I think you are trying to do. It looks up in the registry the application that is associated witha file type, and launches that application in its own thread with the file name as a parameter.

The way Shellexecute does its magic is this:

It goes to the registry under HKEY_CLASSES_ROOT and looks up the file extension. I'll use .doc as an example. If I look in HKEY_CLASSES_ROOT at the folder .doc and look at its default value, I find "Word.Application.8". I then look up this file type in the second half of the HKEY_CLASSES_ROOT folder, and drill down into HKEY_CLASSES_ROOT\Word.Document.8\shell\open\command, I find the command: "C:\Program Files\Microsoft Office\Office\Winword.exe" /n. This command is what is run internally when you double click on a file of type .doc. Every file type that can be double clicked to open an application has a \shell\open\command directory and therein is contained the information used to open that file.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform