Skip to main content
gamedev.net
🔒 Locked

CreateProcess problem

Started by Thomo Apr 10, 2006 at 8:46 AM 5 replies 500+ views
Original Post
Thomo
Thomo
I have a problem with the CreateProcess function in win32. I have a windowed app that calls CreateProcess after a specific command. The CreateProcess is called and I get the console window of the console application. However, there is no output in the console window. It should print "Hello World" as a test. It is not doing so. The console application prints the phrase correctly as a stand alone application. Does anybody know something I don't???
Kambiz
Kambiz
Do you wait until child process exits?
Do you call WaitForSingleObject(...)?
Try also calling cout.flush().
Thomo
Thomo
I'm actually using the C printf statment in the console app.

WaitForSingleObject?? Never heard of that. I'll check it out.
Evil Steve
Evil Steve
Try adding something else to the console app, like a MessageBeep(). That'll let you know if the process is actually created, or if it's a buffered output problem or something.

What does your CreateProcess call look like?
Evil Steve
Evil Steve
Quote:
STARTF_USESTDHANDLES
Sets the standard input, standard output, and standard error handles for the process to the handles specified in the hStdInput, hStdOutput, and hStdError members of the STARTUPINFO structure. For this to work properly, the handles must be inheritable and the CreateProcess function's bInheritHandles parameter must be set to TRUE. For more information, see Handle Inheritance.
Your output handle is NULL, so the process isn't displaying anything to anywhere. The only member of the STARTUPINFO structure you need to set is cb.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.