Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Launching other apps from VFP 5.0
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00109253
Message ID:
00109259
Views:
20
>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"
* lcFile is your file name
lcparameters = ""
* I use Foxtools to get the path
lcDirectory = JustPath(lcfile)
* Restore the window to its last postion
lnshow = 9
lnresult = ShellExecute(0, @lcOperation, @lcFile, @lcparameters,;
  @lcDirectory, lnshow)
* If lnresult = 31 the file isn't associated with an application
hth,
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform