Skip to main content
GameDev.net gamedev.net
🔒 Locked

Gui for console applications

Started by Hairu Jan 21, 2003 at 4:36 PM 1 replies 600+ views
Original Post
Hairu
Hairu
I need to make a gui for traceroute and whois in windows. These are console applications so I somehow need to read the output from them with my GUI program. The problem is, _popen() doesn''t work in non-console windows applications. I''ve tried using CreateProcess, and CreatePipe, but the still made a dos box appear ( which i cant allow ), and besides that, they still didn''t work properly for my purposes. Any ideas? Or does anyone know where I can get the source to a small program that''s a GUI to a console program?
LessBread
LessBread
You can hide the resulting popup console window by setting the appropriate flags of the STARTINFO structure before calling CreateProcess. To obtain the output from the process, you can set up an anonymous pipe, duplicate it and assign it to the std handle members of the STARTINFO structure. Then you can read from that pipe, dumping the output string to an edit box or some other GUI control. Here is a small C program that demonstrates how to do all this: ReadPipe.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
Hairu
Hairu
Cool, thanks a bunch.

Topic Locked

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

Sign in to reply to this topic.