'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

Recommended Answers

All 7 Replies

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.

Are you using main() or WinMain() as the program's entry point?

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

Hahaha, well thanks for trying =)

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.