Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determine if MS Excel is installed?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01557379
Message ID:
01557383
Views:
85
Likes (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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform