Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ShellExecute()
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00092846
Message ID:
00092910
Views:
37
>George,
>
>When I was working on this last summer I did this:
>
declare long GetDesktopWindow in "win32api"
>
>local hDCScreen
>
>hDCScreen = GetDesktopWindow()
>
>this.Value = ShellExecute( hDCScreen, ;
>                           this.mcOperation, ;
>                           this.mcDocApp, ;
>                           this.mcParameters, ;
>                           this.mcDefaultDir, ;
>                           this.mnShowCommand )
>
>
>>Yep, you can use ShellExecute() to run a DOS program, just pass it the proper parameters. You really don't need a window handle. Be sure that the command is "open" and the show state is one that will display the window (not hide it).

As far as DOS commands, your post pointed out something I did wrong with that. While in the midst of goofying around with it, my machine locked up. When I rebooted (and it being Friday, my typical "duh"-day. :-)) I inadvertantly inverted the second and third parameters. Now know why I kept getting ERROR_FILE_NOT_FOUND (2).

To make ShellExecute() work with DOS commands, pass COMMAND.COM as the program to execute, and the command as the parameters. For example:
lcdos = "C:\COMMAND.COM"
lcop = "open"
lcdir = ""
lcparms = "COPY AUTOEXEC.BAT AUTOEXEC.FOO"
* Execute in minized window
lnresult = ShellExecute(0, @lcop, @lcdos, @lcparms, @lcdir, 7)
Thanks for the post, David.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform