Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What application is associated with an extension
Message
 
 
To
15/01/2003 20:26:11
Michael Ouellette
Australian Technical Services (VIC) Pty
Australia
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00742205
Message ID:
00742226
Views:
38
This message has been marked as the solution to the initial question of the thread.
You can use FindExecutable function and create temp file with requered extension for it.
DECLARE INTEGER FindExecutable IN Shell32;
  STRING lpFile, STRING lpDirectory, STRING @lpResult
  
lcFileExt = ".zip" 
lcTempFile = ADDBS(SYS(2023)) + SYS(2015) + lcFileExt 
STRTOFILE("*", lcTempFile )
lcBuffer = SPACE(200)
lnResult = FindExecutable(lcTempFile, "", @lcBuffer)
IF lnResult > 32 
  lcExeName =  LEFT(lcBuffer, AT(CHR(0), lcBuffer)-1)
ELSE
  * No program associated with this extension
  lcExeName = ""
ENDIF  
? lcExeName  
ERASE (lcTempFile)

* If it returns short file name
* You can get long file name using GetLongPathName function
DECLARE INTEGER GetLongPathName IN Kernel32 ;
  STRING lpszShortPath,  STRING @lpszLongPath, INTEGER @cchBuffer
 
lcBuffer = SPACE(256)
lnBuffLen = 256
? GetLongPathName(lcExeName, @lcBuffer, @lnBuffLen )
lcExeName  = LEFT(lcBuffer, AT(CHR(0), lcBuffer)-1)
? lcExeName  
  
>I want to find out if Winzip is installed on a client's machine. I know I don't always install programs in their "prefered" directories so how can I really find out if .zip is associated with winzip. I found an API function in Win API section but the function requires an actual zip file to exist. The function also returned the path in DOS format ( c:\progra~1\winzip8 ). There must be an easier way. I'm here using Winzip as an example but I also want to know if .doc is Word or WordPerfect etc
>
>Thanks in advance
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform