Shadowwind (Lily has died) 17:22:25 on
VC/MFC/
Basic ClassHow to call the console program: 1. Hide the console window; 2. Get the exit status of the console Program
I use system and _ spawnlp. The returned value is exit code, but the window cannot be hidden.
Windows can be hidden with winexec (command, sw_hide), but no exit code is available.
Thank you for your advice ~ Number of questions: 100, replies: 6
Keiy () on the first floor replied to 17:37:04 score 0 use CreateProcess + getexitcodeprocess to try
Top
Wly033 (ming) on the second floor: reply to 18:06:31 score 5 CreateProcess + waitforsingleobject + getexitcodeprocess
Top
Subtop (seeking job...) on the third floor replied to 18:44:58 score 5. Try the upstairs method.
Top
On the 4th floor, keiy () replied to the error: 19:04:11 score 0. I tried it. I have a problem.
CreateProcess if startf_useshowwindow + sw_hide is used
Waitforsingleobject does not return
Getexitcodeprocess does not return values either.
If you do not need startf_useshowwindow, you can get the exitcode normally.
Top
On the fifth floor, keiy () replied to the success score of 90 at 19:48:06:
Process_information PI;
Startupinfo Si;
// Set up the start up info struct.
Zeromemory (& Si, sizeof (startupinfo ));
Si. dwflags = startf_useshowwindow;
Si. wshowwindow = sw_hide;
CreateProcess (null, "d: // temp // t.exe", null, null, 0,
Null, null, null, & Si, & PI );
Waitforsingleobject (PI. hthread, infinite );
Closehandle (PI. hthread );
DWORD excode = 0;
Getexitcodeprocess (PI. hprocess, & excode );
// Excode is returned
Top
The keiy () on the sixth floor is replied to the score of 0 at 19:51:23,. In addition, Si. wshowwindow = sw_hide; save
(Because the value of sw_hide is 0)