Jump to content
gordonramp

LE3 Hide Dos Screen

Recommended Posts

When a project is published and executed a black and white Dos screen precedes the program. It would be much better if this could be hidden.

I'm also wondering if the program window can be centered on a screen.

Share this post


Link to post

There's a Visual Studio project setting to disable this, but I can't remember off the top of my head. Chris knows the answer.

Share this post


Link to post
Guest Red Ocktober

target a win32gui app instead of a Win32 console app...

 

 

under properties the linker page... linker /system /subsystem

 

right now it probably reads /subsystem=Console(/SUBSYSTEM:CONSOLE)

change it to

properties /linker /system /subsystem=Windows(/SUBSYSTEM:WINDOWS)

 

is that the setting you're looking for?

 

 

--Mike

Share this post


Link to post

FYI, you also have to change "main" to "WinMain":

int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Share this post


Link to post

There an much easier way, just insert this line into your source code, no need to change compiler settings or change the main function:

 

#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")

Share this post


Link to post

Nice. Will it accept the main() function, even though the arguments are different from WinMain()?

Share this post


Link to post

Yes, your main function will work as usual, including its command line parameters.

Your main function should be always:

int main(int argc, char* argv[])

Don't use variations of this, for example argv**, because they are not compatible with some 3rd party libs.

Share this post


Link to post

When a project is published and executed a black and white Dos screen precedes the program. It would be much better if this could be hidden.

 

There an much easier way, just insert this line into your source code, no need to change compiler settings or change the main function:

 

#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")

 

Thanks, that's exactly what I was looking for!

 

I've added a build target switch, so console window will only appear on debug build:

 

#ifndef DEBUG
   #pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
#endif

I've put that on top of main.cpp.

Share this post


Link to post

Thanks, that's exactly what I was looking for!

 

I've added a build target switch, so console window will only appear on debug build:

 

#ifndef DEBUG
#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
#endif

I've put that on top of main.cpp.

Wow that was lean code. Thanks!

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...