Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Issuing NT/DOS commands without the ! (hide the window)
Message
 
 
To
13/04/1998 16:41:31
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00088829
Message ID:
00091721
Views:
40
>Michale,
>
>That lead was great. Thanks.
>
>Now I have a question about how to invoke "built-in" DOS commands like TYPE or ATTRIB or COPY via ShellExecute.
>
>(I know some of these can be done directly with VFP commands; I'm interested in the general answer for those commands that don't have a VFP equivalent.)
>
>I know how to invoke stand-alone apps using the calling conventions above, but how do I call, for example, ATTRIB -- what file and what parameters do I pass? I tried experimenting with various options, but although the return code indicates success, I am not seeing aything happen.
>
>Any leads appreciated.
>
>-- jas


Jas,

When testing the api call you can change nShowCmd from 0 to 3 to view maximized, then you can see the what is happening (Sorry, I put 1 for maximized previously). Below is an example of executing the DOS edit command.
DECLARE INTEGER ShellExecute IN Shell32;
    INTEGER HWND,;
    STRING @lpOperation,;
    STRING @lpFile,;
    STRING @lpParameters,;
    STRING @lpDirectory,;
    INTEGER nShowCmd

Whandle = -1	 		 &&Should include window handle to receive any message boxes from application.
lpOperation="open"		 &&May also be "print" or "explore"
lpFile="edit"			 &&Your command to execute
lpParameters="test.fil"+CHR(0)	 &&Include any parameters to be passed to executable
lpDirectory="C:\"+CHR(0) &&Default directory
nShowCmd=3				 && 0=hide, 3=show maximized, 2= show minimized
lnsuccess=ShellExecute(Whandle,@lpOperation,@lpFile,@lpParameters,@lpDirectory,nShowCmd)
*returned value >32 then operation successful
CLEAR DLLS
As far as Attrib, there is an example in the files section using API calls to do this.
Michael McLain
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform