>When you double click on a file listed in the explorer, it launches the app that created it, if windows recognizes the file type. For example, if you double click on an XLS file, it launches excel and brings up the document.
>I want to do the same thing in VFP. I have a listbox that contains a document(s) that came attached to an email (I am working on an email application). I'm able to parse out the document, but I would like to make the app work more like other email apps that allow you to double click on the attachment to view it. As it works now, you have to leave VFP and double click on the document from My Computer or the Explorer. Is it possible to do this inside VFP 5? Is there a way to do it without having to DO Case out every possible type of file?
The key to this is the API function ShellExecute(). Here's the declaration:
DECLARE INTEGER ShellExecute IN Shell32;
INTEGER hwnd, STRING @lpOperation, STRING @lpFile,;
STRING @lpParameters, STRING @lpDirectory, SHORT nshow
lcoperation = "open"
lcparameters = ""
lcDirectory = JustPath(lcfile)
lnshow = 9
lnresult = ShellExecute(0, @lcOperation, @lcFile, @lcparameters,;
@lcDirectory, lnshow)
hth,
George
Ubi caritas et amor, deus ibi est