Jump to content
  • Advertisement
Sign in to follow this  
NicoG

Requirements for programming a Console

This topic is 3569 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

Hi there. I would like to do some sort of Console in Win32. With console I mean some replacement for cmd.exe. There are very cool solutions for Linux, but Win32 lacks of a cool console which can drop down from the top of your screen and stuff like that :D. I didn't find anything useful on google, so I ask myself, how would you achieve this? My Idea: I open a Pipe to an instance of cmd.exe and just write the orders into the pipe and read the output from there. Never done that before, is my approach correct? About "drawing": I would need to draw all the output to the console via a font (GDI) by myself, right? Since I need a Window on which I have full control for hiding and moving etc, I can't use the standard console window. Which Language would you prefer? I can program in C++ and C pretty well (in my eyes :D), I want to learn C# anyway, so I would do it in C# for learning. Any suggestions? Any Critical requirements I did not see? Best regards

Share this post


Link to post
Share on other sites
Advertisement
A pipe wouldn't really work. For one thing you'd need three pipes one for each of stdin, stdout and stderr. However, even if you did that you'd still have the problem that the streams don't contain positioning information or color.

A better approach in C or C++ would be to use the console functions like GetConsoleScreenBufferInfo(), ReadConsoleOutput() and so on to get information on the console's contents, and just use window messages to send events like WM_KEYDOWN to the console window. In theory, you should be able to use these functions from C# too, but I've never tried it.

Share this post


Link to post
Share on other sites
Quote:
Original post by SiCrane
A pipe wouldn't really work. For one thing you'd need three pipes one for each of stdin, stdout and stderr. However, even if you did that you'd still have the problem that the streams don't contain positioning information or color.

A better approach in C or C++ would be to use the console functions like GetConsoleScreenBufferInfo(), ReadConsoleOutput() and so on to get information on the console's contents, and just use window messages to send events like WM_KEYDOWN to the console window. In theory, you should be able to use these functions from C# too, but I've never tried it.

Those functions is mirrored in native .NET methods in the System.Console class.

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!