Writing a GUI for a console program?

  • Thread starter Thread starter Falo
  • Start date Start date
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?
 
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
 
Back
Top