Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Launching other apps from VFP 5.0
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00109253
Message ID:
00109259
Vues:
21
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform