Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cannot View PDF with ShellExecute
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01554652
Message ID:
01554896
Vues:
42
How to find an application associated with the file name
http://www.news2news.com/vfp/?example=138

On my computer, the code below returns
D:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe

Note that file c:\temp\test.pdf must exist, though in fact this can be just a dummy file of zero size.
DECLARE INTEGER FindExecutable IN shell32;
    STRING lpFile, STRING lpDir, STRING @lpResult
 
lcResult = SPACE(250)
 
IF FindExecutable ("c:\temp\test.pdf", "", @lcResult) > 32
    lcResult = ALLTRIM(STRTRAN(lcResult, Chr(0), " "))
    ? lcResult
ELSE
    *    2 = ERROR_FILE_NOT_FOUND
    *    3 = ERROR_PATH_NOT_FOUND
    *   21 = ERROR_NOT_READY
    *  127 = ERROR_PROC_NOT_FOUND
    * 1008 = ERROR_NO_TOKEN
 
    DECLARE INTEGER GetLastError IN kernel32
    ? "Error code:", GetLastError()
ENDIF
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform