'Ello again,

I have a question about C++ GUI's, with Code::Blocks as my IDE. Whenever I make a basic GUI with the Win32 API, it always creates a console _and_ the GUI (as shown in the picture attached). I was wondering how to only create the GUI, or at least make the console not visible.

Normally this wouldn't be a problem, but this time, when you click the button in my GUI, it starts another console app I made. The thing is when it starts this console app, it starts it _in_ the console that is originally made with the GUI. This may seem fine, but it makes the GUI not respond, thus, a problem. I was thinking that maybe if I create another process, and have it open my console app that it wouldn't freak out, but before I went through such an undertaking, I just wanted to make sure there wasn't some blatantly obvious solution.

Thanks
~Mr. Appleseed

Attachments CodeBlocksExample.PNG 55.78 KB

If you use a console application, that will use the console subsystem. If you use a windows (win32) application, a console won't be created for you and your GUI will load alone. I don't recall off the top of my head if Code::Blocks has win32 project templates, sorry.

It does have the Win32 template, but even when you just run the template it still creates the console.

I believe WinMain() .. The code is:

int WINAPI WinMain (HINSTANCE hThisInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR lpszArgument,
                     int nCmdShow)

Then I'll defer to someone who does more Win32 programming on Code::Blocks than little ol' me. :D

I have a question about C++ GUI's, with Code::Blocks as my IDE. Whenever I make a basic GUI with the Win32 API, it always creates a console _and_ the GUI (as shown in the picture attached). I was wondering how to only create the GUI, or at least make the console not visible.

Code::Blocks normally creates the console window when you run the "Debug" build target. If you switch the build target to "Release", it should only show the GUI.

You can change this if you want. Go to the "Project" menu and select "Properties". Under the "Build targets" tab, you'll see a combo box labeled "Type". For the "Debug" target, this is set to "Console application" by default. Change it to "GUI application", and *poof*--no more console window when running the debug build.

This article has been dead for over six months. Start a new discussion instead.