Jump to content
  • Advertisement
Sign in to follow this  
dadads

GUI Frontend for Console Program

This topic is 3659 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Dear Reader: I would like to create a GUI front-end to a console program of mine without having to modify the console program itself. My plan is for the GUI front-end program to be able to call and provide input to the console program, and re-route the output from the console program onto itself so that the output from that particular console program can be parsed by the front-end and re-formatted before being displayed to users. I am planning to start creating this GUI front-end in C++, but so far I haven't been able to find: 1. How to re-route the console program's output from "standard out" into the front-end program for parsing. 2. How to make the front-end program call the console program using a set of specified arguments. 3. How to hide the console program when the front-end program calls it. I am looking for pointers, guidances, or links to resources that would help me solve the three problems above. If this information would help, the target system is Windows, although it'd be great if the GUI front-end is also portable across Unix-based systems. Finally, I would also like to thank those who participated in this thread for their sincere opinions. Thanks and Regards, - dadads -

Share this post


Link to post
Share on other sites
Advertisement
You could get started with this. It shows how to spawn processes with redirected output handles. Basically you need to create some pipes for the input and output and tell the CreateProcess function to use them.

If I were you, I'd write the app in C#, you can probably hack it up in about 20 lines since all those nasty Win32 API calls are wrapped up in the System.Diagnostics.Process and Stream classes.

Share this post


Link to post
Share on other sites
I've done this with the win32 api and it's a royal pain. C# (or Java) would make it easier but they also make deployment a bit more problematic.

Quote:
it'd be great if the GUI front-end is also portable across Unix-based systems.


I know Qt can handle this across systems, not sure about gtk. I have become enamored with Qt lately, it's really very nice.

Share this post


Link to post
Share on other sites
If you want to go the Linux route with C#, check out the mono project. It is an open source implementation of the .NET Framework and enables you to build cross platform .NET applications. There are some fairly nice tools out there for the mono framework.

Mono Project

If you are more comfortable with C++, QT is defiantly the way to go. Just be aware that if this is for a commericial project, QT is not free. You will need an commerical license if you wish to not open source your application.

Share this post


Link to post
Share on other sites
It's not too difficult to create a GUI front end for console based programs. Here is a rudimentary example of such a program that I wrote a few years ago in C: readpipe.zip.

The code is written to spawn instances of various utilities that came with the compiler this sample code was meant to be used with. Adapt the calls to CreateProcess found inside the WM_COMMAND to suit your needs. YMMV. The program could stand some serious re-engineering. [smile]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!