Disabling the console

So, I've been working on a windowed program that really has no use for the "DOS" console since all data is shared via the windows. Is there a (simple) way of stopping the console from appearing in the first place?
What platform, what compiler, and what API are you using? The answer to your question is directly dependant on the answer to that question.

For example, if you're compiling an MS windows app using VC++ 200X using the Win32 API, you have to compile the project as a Win32 application, not a console application, and you have to redefine your "main()" entry point from
int main(int argc, _TCHAR* argv[])
to something like
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

If however, you're using something like wxWidgets with gcc, it's different.
Oh, my bad. I thought my OP was a bit short...

And yes, I am on VC++ 2008 Express on Win32.

I feared that my initial choice of the program as a console application was the issue... is there any problem with a good ol' copy-paste from a console to a Win32 application? Other than the change from main to WinMain, that is.

However... bugger, just realized I can't change the 'main' header. I'm using an in-house GUI library that needs to be initialized using the function IUPOpen(&argc, &argv). So I'm kind of stuck with this header. Oh shucks.
Can't you do something like:
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
#include <windows.h>

int main()
{
	HWND myWindow;
	myWindow = FindWindowA( "ConsoleWindowClass", NULL );
	ShowWindow(myWindow, 0);

	return 0;
}


or

Project->Properties(Alt+f7)->Configuration Properties->Linker->System.

Top box SubSystem set it to - Windows(/SUBSYSTEM:WINDOWS)
However... bugger, just realized I can't change the 'main' header. I'm using an in-house GUI library that needs to be initialized using the function IUPOpen(&argc, &argv). So I'm kind of stuck with this header. Oh shucks.


The lpCmdLine parameter is the null terminated string of parameters passed to the application at the command line (not including the executable name itself).

CommandLinetoArgvW is a function call to convert this string into argv and argc values.

A quick search of MSDN should provide you with some info, and probably sample code, on performing the appropriate conversion for your GUI function call.
Sorry for bringing this thread back from the dead, but I just saw these two extra posts and thought it worth mentioning that Mythios' solution works beautifully.

I'm starting to miss that black screen hovering ominously in the background, though...
Topic archived. No new replies allowed.