[Solved] Console issues

Started by
5 comments, last by Impz0r 17 years, 9 months ago
Heya, i've got a question about using a Console within a Win32 Application. I wanna use the Console for dumping my Log strings. This does allready work but the thing is, if i close the Console and not the Main Window i've got a couple of errors. Like the main thread isn't terminated in the correct way (wierd return code) ... not releasing resources at all ... etc.. So i guess what i'm ask is, how could i disable the possibility to close or interact with the console at all. I just want to use it as a information to the User, nothing more nothing less. He should'nt allowed to interact with die Console. Thanks in advance. Mfg Impz0r [Edited by - Impz0r on July 21, 2006 10:17:23 AM]
Stay Evil & Ugly!
Advertisement
Not sure you can. I've never seen a console window used like this, although someone else may be able to correct me on this.

Wouldn't it be easier to create your own "console" window with a client-aligned read-only edit box? This seems to be how the "console windows" that a lot of games have at start up seem to be working.
This might be what you want. Create a non-console application, then allocate the console at initialisation. Should do the trick.
Thanks guys for your replys!

@EasilyConfused

Well that might be a solution, however i wanted to avoid if it's possible. Maybe i end up doing it anyway ...


@f8k8

I allready do create a non-console application and allocate with "AllocConsole()" a new console. Thats not the problem. The thing is, i want to "disable" the possibility to close the console by the user. Only the application should allowed to do that. Because of the "undefined" behavior it cause.



Mfg Impz0r
Stay Evil & Ugly!
Not sure if this is helpful but perhaps if you created the console as a seperate process, then tied it to your application with AttachConsole rather than using AllocConsole, it could be closed without errors.

I don't personally know anything about this. Just the best idea a quick search of MSDN presented.

If you just want output, and no input, surely a fixed sized window along with some kind of internal string buffer you manage and calls to DrawTextEx would be sufficient though?
Quote:Original post by Impz0r
The thing is, i want to "disable" the possibility to close the console by the user.

It's rather easy to accomplish: DeleteMenu(GetSystemMenu(GetConsoleWindow(), FALSE), SC_CLOSE, MF_BYCOMMAND);

Note that GetConsoleWindow requires anything that's >= Win2k, if that's a problem, then you can use FindWindow instead.
Thanks raz0r your Solution works like a charm :)


Mfg Impz0r
Stay Evil & Ugly!

This topic is closed to new replies.

Advertisement