Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Determine if MS Excel is installed?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01557379
Message ID:
01557383
Vues:
86
J'aime (1)
Finding the application, icon and friendly names associated with a file name
http://www.news2news.com/vfp/?example=584
#DEFINE MAX_PATH 260
 
#DEFINE ASSOCSTR_EXECUTABLE 2
#DEFINE ASSOCSTR_FRIENDLYDOCNAME 3
#DEFINE ASSOCSTR_FRIENDLYAPPNAME 4
#DEFINE ASSOCSTR_DEFAULTICON 15
 
DO declare
 
LOCAL cFileType
cFileType = ".xls"
 
? GetAssociation(m.cFileType, ASSOCSTR_EXECUTABLE)
? GetAssociation(m.cFileType, ASSOCSTR_FRIENDLYDOCNAME)
? GetAssociation(m.cFileType, ASSOCSTR_FRIENDLYAPPNAME)
? GetAssociation(m.cFileType, ASSOCSTR_DEFAULTICON)
 
FUNCTION GetAssociation(;
        cFileType as String,;
        nAssociationType) as String
 
    LOCAL nBufSize, cBuffer, nResult
 
    nBufSize = MAX_PATH
    cBuffer = REPLICATE(CHR(0), nBufSize)
 
    nResult = AssocQueryString(;
        0,;
        m.nAssociationType,;
        m.cFileType,;
        "open",;
        @cBuffer,;
        @nBufSize)
 
RETURN IIF(nResult=0,;
    SUBSTR(cBuffer, 1, nBufSize-1), "")
 
PROCEDURE declare
 
    DECLARE INTEGER AssocQueryString IN Shlwapi;
        INTEGER queryFlags, INTEGER queryString,;
        STRING pszAssoc, STRING pszExtra,;
        STRING @pszOut, INTEGER @pcchOut
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform