Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Open With dialog
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00180046
Message ID:
00181068
Vues:
18
>>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.
>
>Hi Erik,
>
>Just to add a bit, if ShellExecute fails because the extension of the file isn't associated with an application, like FindExecutable, it will return 31. There are situations where you would need to know the executable prior to starting the app, in order to know how to proceed once the application starts (OLE servers come immediately to mind).


Thanks for all your help. I found a Knowledge Base article that also helped.

HOWTO: Invoke the "Open With..." Dialog Box Using ShellExecute

at 'http://support.microsoft.com/support/kb/articles/q192/3/52.asp?FR=0'
Dennis Lindeman
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform