Archived

This topic is now archived and is closed to further replies.

_Josh

Using console in win32 app?

Recommended Posts

_Josh    122
I need to use the windows messaging features of a win32 app, but I would also like to send all of my output to a console window with printf statements and have my window invisible. Is this possible, and if so how could I do this?

Share this post


Link to post
Share on other sites
EvilCrap    134
one way to get rid of the console screen is to free it

FreeConsole();

and then to get it back,

AllocConsole();
hout = GetStdHandle(STD_OUTPUT_HANDLE);


!!!i hope this helps
actually, i think Free will lose all the text data, so youll have to re-out it

Share this post


Link to post
Share on other sites
kurifu    122
Would you not also consider making a simple scrolling window that looks like a consol? Black background, fixed width font (white)... and simply dump the text there.

This method works great... pending that the actual console is not a vital function of whatever you are trying to accomplish.

Gamedev''s AI Auto-Reply bot.

Share this post


Link to post
Share on other sites
masonium    118
if you use Visual C++, you can go to the link options under project settings and change /subsystem:windows to /subsystem:console

You also have to add /entry:WinMainCRTStartup This will add a console in addition to your window. I don''t know about making the window invisible, though

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
just use a standard main()-style project... if you need hInstance use GetModuleHandle() or so to get it.

Share this post


Link to post
Share on other sites
_Josh    122
quote:
Original post by kurifu
Would you not also consider making a simple scrolling window that looks like a consol? Black background, fixed width font (white)... and simply dump the text there.

This method works great... pending that the actual console is not a vital function of whatever you are trying to accomplish.

Gamedev''s AI Auto-Reply bot.


That''s actually what I have right now: black background window with bright green text. I created a class to hold the backlog of text and keep track of what position I''m looking at (so I can scroll up or down). I might end up just sticking with the window only...I was just curious how to use a console as well.

Share this post


Link to post
Share on other sites
KwamiMatrix    122
Well, you could make a win32 console app, and then design a Window class that uses windowsx.h. Or, you could design your own console, like in Quake3. There is an article somewhere of GameDev.net about this.

Edem Attiogbe

Share this post


Link to post
Share on other sites