For example, in C#, you can make a program run without the black screen appearing...so I thought: since anything you can do with .NET you can also do with Win32, maybe there's a solution.
Any ideas?
For example, in C#, you can make a program run without the black screen appearing...so I thought: since anything you can do with .NET you can also do with Win32, maybe there's a solution.
Any ideas?
The console window appears when the program is linked with /SUBSYSTEM:CONSOLE
which is the default if you haven't asked for anything else.
If you want it to be a "Windows App" i.e. "make GUI contributions" including being invisible, link with /SUBSYSTEM:WINDOWS
. However, you will need a WinMain
function rather than the usual main
function.
Open Project - Properties, and set /SUBSYSTEM linker option to WINDOWS.
I have a header file "MainEntryPoint.h" that contains the following text:
#pragma once
#if defined _MSC_VER
#if !defined _WINDLL
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
#endif
I #include this file in the main.cpp file of any project that
windows
rather than console appmain()
) C / C++ entry point for all my projects.(The guard macro's automatically ensure it only applies to DevStudio builds and excludes messing with the entry point when building a dll).