Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
PROCESS.VCX (API_APPRUN)
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00225698
Message ID:
00226523
Views:
48
>Dragan,
>
>Thanks, I might try this when I get a chance.
>
>When you say "The last three DWORDs of the STARTUPINFO structure can contain file handles to be passed to the new process to redirect the STDIN, STDOUT and STDERROR of the new process respectively." I assume that you mean to change the REPL(CHR(0),23) line below and insert the 4 byte string representing the handle as the third 4 byte string from the end. Is that right?
>
>
  cStartUpInfo = CHR(68) + ;
>	        REPL(CHR(0),43) + ;
>           	CHR(1) + ;
>        	REPL(CHR(0),23)
>

That's the structure; i don't break it out completely, since I don't use most of it. The dwFlags member in the structure starts where you see CHR(1); to set the necessary bits in the dwFlags value, substitute the following for the REPL(CHR(0),23):

CHR(1) + REPL(CHR(0),11) + ;
4 byte string for STDIN handle + ;
4 byte string for STDOUT handle + ;
4 byte string for STDERROR handle

If you have the integer returned by FOPEN() for the STDIN, you can convert it to a DWORD string using the functions in my CLSHEAP procedure library. For handles that you don't want to redirect, put in REPL(CHR(0),4) - a DWORD value of 0.

You might want to take a look at the STARTUPINFO structure in detail, there's a lot of neat stuff you can do with it.

>The dwFlag that you talk about; Is this the dwCreatFlags parameter that is the 6th parameter in the statement below or is there a flag in the cStartInfo parameter created above?
>
>
 lResult = CrPr(	0, ;
>	        cCommandLine, ;
>        	0, 0, 0, 0, 0, ;
>	        uFromDir, ;
>        	@cStartUpInfo, ;
>	        @cProcessInfo)
>
>Thanks for the help. I'm a little out of my league when dealing with API calls.
>
>You say "where I build the structure in the LaunchApp method.". I was wondering, since it is not signed, who shoud I be thanking for this wonderful class? You or Ed Rauh?
>

I'm the author on API_APPRUN who's been too lazy to document it other than comments in the code...

>Ed
>
>>With a little tweaking, you can redirect STDIN, STDERROR and STDOUT through the STARTUPINFO structure. The last three DWORDs of the STARTUPINFO structure can contain file handles to be passed to the new process to redirect the STDIN, STDOUT and STDERROR of the new process respectively. You'd need to open the source for STDIN in your process, set an additional bit in the STARTUPINFO dwFlags member to indicate that you wanted to override the stard I/O (you'd OR the current value of the dwFlags member with 0x0100), convert the handle to a DWORD (a 4 byte string representing an unsigned 32 bit integer integer) and put the DWORD into the STARTINFO structure at the correct offset in the structure. If you look at the source for API_APPRUN, you can see where I build the structure in the LaunchApp method.
>>
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform