Jump to content

LE3 Hide Dos Screen


gordonramp
 Share

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.

AMD Athlon x2 7750 2.7ghz, 6gb ddr2 ram, Galaxy9800GT 1gig ddr2 video card, Windows 7,64.

Link to comment
Share on other sites

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.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

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")

  • Upvote 2

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

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.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

  • 1 year later...

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.

  • Upvote 1
Link to comment
Share on other sites

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!
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.

 Share

×
×
  • Create New...