Sign in to follow this  
Impz0r

[Solved] Console issues

Recommended Posts

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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
This might be what you want. Create a non-console application, then allocate the console at initialisation. Should do the trick.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this