Writing a GUI for a console program?

F

Falo

I've seen GUIs for console applications where the console window is hidden.
How is this done, and how is the GUI app "tied" to the console app? That is,
I know how to pass commands to an app at startup, but how do I continue to
feed commands to the app during the course of it's run?
 
Q

Quinn Tyler Jackson

Falo said:
I've seen GUIs for console applications where the console window is hidden.
How is this done, and how is the GUI app "tied" to the console app? That is,
I know how to pass commands to an app at startup, but how do I continue to
feed commands to the app during the course of it's run?


See AllocConsole() in the Win32 SDK documentation -- this will allow you to
open a console from a GUI app. You can then (using multithreading and
synchronization objects) "feed" the console using standard means, such as
std::cin, which in turn "pump" the commands into GUI elements.

That's one way to do it, anyway.

Another way is to use a MUTEX to prevent multiple instances of your
application from running. Just before you do that, you can check the command
line of the second instance and use interprocess calling to "feed" the
second command line to the first launched instance.

Quinn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top