Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieving Windows File Associations via VFP
Message
From
02/06/2003 11:50:56
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
02/06/2003 11:41:19
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00795191
Message ID:
00795272
Views:
48
>Cetin,
>
>I'll nutshell for you what I'm trying to do in my application:
>
>I want to load a File Open Dialog; have the user select a drawing (raster type) file; Click OK; Load the Drawing Viewer program with the selected file loaded in Drawing Viewer application.
>
>I know that GETFILE() will return something like E:\DATA\DWG\2299\2299A.MIL.
>
>I can then parse this string for .MIL extension, pass this extension to your method to find the Drawing Viewer program; then exec this application with ShellExecute() with this file loaded.
>
>Fz

OK Donald,
You know the filename returned from GetFile() :
lcFile = "E:\DATA\DWG\2299\2299A.MIL"

If you're not really interested in knowing which exe runs it (Like windows explorer dblclick and it opens with associated file) :

Need to wait for return (George Tasker's code) :
oWS = createobject('Wscript.Shell')
oWS.Run(lcFile,5,.t.)
You don't want to wait for a return (as if user independently dblclicked in windows explorer) :
declare long ShellExecute in "shell32.dll" ;
	long hwnd, string lpszOp, ;
	string lpszFile, string lpszParams, ;
    string lpszDir, long nShowCmd

ShellExecute(0,'Open',lcFile,0,0,1)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform