Dozz Posted April 29, 2012 Share Posted April 29, 2012 I'm a bit wary to change settings in visual c++ 2008 express. I want to disable the console window that displays loading shaders etc. but not sure how I do that. I want the splash screen to display straight away & not be interrupted by the console. Thanks Dozz 1 Quote Link to comment Share on other sites More sharing options...
Roland Posted April 29, 2012 Share Posted April 29, 2012 1. In Linker/System/SubSystem change Console to Windows 2. In your code change int main( int argn, char* argv[] ) to int CALLBACK WinMain( __in HINSTANCE hInstance, __in HINSTANCE hPrevInstance, __in LPSTR lpCmdLine, __in int nCmdShow ) Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Dozz Posted April 30, 2012 Author Share Posted April 30, 2012 That did the trick, thanks Roland. When I run the .exe the screen flashes black, then there is a delay of a few seconds before it runs. Is this the engine setting up? Even though it's only a few seconds, it bugs me. Is it typical for this to happen with Leadwerks? If so then so be it, else I will try invoking the splash screen earlier in the code. Thanks again. Dozz Quote Link to comment Share on other sites More sharing options...
Birdman Posted May 3, 2012 Share Posted May 3, 2012 Loading a map take time, i was working this week in designing a splash screen, idk if somobody did this already, gotta check. Quote Link to comment Share on other sites More sharing options...
DigitalHax Posted May 3, 2012 Share Posted May 3, 2012 Only in Bmax Quote Win7 64bit, Leadwerks SDK 2.5, Visual Studio 2012, 3DWS, 3ds Max, Photoshop CS5. Life is too short to remove USB safely. Link to comment Share on other sites More sharing options...
Canardia Posted May 4, 2012 Share Posted May 4, 2012 Instead of doing that complicated WinMain function, you can just use the main function and add the compiler option -mwindows for g++. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Roland Posted May 4, 2012 Share Posted May 4, 2012 I'm a bit wary to change settings in visual c++ 2008 express. I want to disable the console window that displays loading shaders etc. but not sure how I do that. I want the splash screen to display straight away & not be interrupted by the console. Thanks Dozz Instead of doing that complicated WinMain function, you can just use the main function and add the compiler option -mwindows for g++. You are not answering the question . As you see he's using Visual c++ 2008. There is no g++ there. Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Canardia Posted May 4, 2012 Share Posted May 4, 2012 It's similar in Visual Studio also, there you can disable the console window with compiler settings without the need to write a WinMain functions. The easiest way is to use a compiler pragma like: #pragma comment( linker, "/subsystem:"windows" /entry:"mainCRTStartup"" ) Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Roland Posted May 4, 2012 Share Posted May 4, 2012 It's similar in Visual Studio also, there you can disable the console window with compiler settings without the need to write a WinMain functions. The easiest way is to use a compiler pragma like: #pragma comment( linker, "/subsystem:"windows" /entry:"mainCRTStartup"" ) Yes. That's more relevant for Visual Studio and will work also if you find it more easy the WinMain function. Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Canardia Posted May 4, 2012 Share Posted May 4, 2012 I think g++ is also related to Visual Studio though, that's why I mentioned that first: g++ is just a cheaper, better, faster Visual Studio. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Furbolg Posted May 4, 2012 Share Posted May 4, 2012 Just in your opinion Lumooja.Visual Studio is also an IDE which has some good features. But thats like your discussion about SDL, SDL_Net and so on ... another story. I would use Rolands suggestion that makes it more clear its an windows project not console. 1 Quote Link to comment Share on other sites More sharing options...
Furbolg Posted May 4, 2012 Share Posted May 4, 2012 Yes Lumooja your opinion is the only one true, there are no other choices. Quote Link to comment Share on other sites More sharing options...
Guest Red Ocktober Posted May 5, 2012 Share Posted May 5, 2012 not wanting to get into the msvc++ vs. gcc debate ... me thinks you guys are missing something quite obvious (console v. no console)... if you choose to make a console project in msvc++, the startup code looks like this... #include "engine.h" int main( int argn, char* argv[] ) if you choose a to make a win version, it looks like this... #include "engine.h" int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd ) if you don't want to display the console, choose a win project... i don't see what the problem is... or am i missing the point of the question... --Mike Quote Link to comment Share on other sites More sharing options...
Roland Posted May 5, 2012 Share Posted May 5, 2012 not wanting to get into the msvc++ vs. gcc debate ... me thinks you guys are missing something quite obvious (console v. no console)... if you choose to make a console project in msvc++, the startup code looks like this... #include "engine.h" int main( int argn, char* argv[] ) if you choose a to make a win version, it looks like this... #include "engine.h" int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd ) if you don't want to display the console, choose a win project... i don't see what the problem is... or am i missing the point of the question... --Mike Absolutely no problems, this is exactly what I told in my answer. The rest is more or less the old 'g++ is better', which is quite unneeded as answer to person asking about what to do in Visual Studio. Not really a 'thread rape' but ... Anyway again. This is the way to do it. Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Furbolg Posted May 5, 2012 Share Posted May 5, 2012 not wanting to get into the msvc++ vs. gcc debate ... me thinks you guys are missing something quite obvious (console v. no console)... if you choose to make a console project in msvc++, the startup code looks like this... #include "engine.h" int main( int argn, char* argv[] ) if you choose a to make a win version, it looks like this... #include "engine.h" int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd ) if you don't want to display the console, choose a win project... i don't see what the problem is... or am i missing the point of the question... --Mike Completly right, i just got the problem that lumooja says "oh its much easier in g++ use -mwindows". The Threadopener said he use Visual Studio and Roland showed him a good solution... i just dont get why lumooja has to go on his g++ crusade again. Nobody says g++/linux is worse but in this case its about Visual Studio, thats my problem so far. Quote Link to comment Share on other sites More sharing options...
Benton Posted May 7, 2012 Share Posted May 7, 2012 How come you guys don't use BSD and Java...? I'm being SARCASTIC. Quote Windows 7 Professional 64 bit, 16 gigs ram, 3.30GHz Quad Core, GeForce GTX 460 one gig, Leadwerks 2.5, Blender 2.62, Photoshop CS3, UU3D Link to comment Share on other sites More sharing options...
Aaron Symons Posted September 25, 2016 Share Posted September 25, 2016 Hi guys, I understand this is a very old thread, but I think main.cpp may have changed since, and in the interest of keeping things updated... I've followed the answers to this question, but main.cpp uses argv and argc to do some setup prior to running the game. So, how would I go about setting up/adjusting the main.cpp? After making the changes suggested by @Roland, there are errors in main.cpp on lines: #44 #63 #66 ...where you can see the usage of argv and argc. I've attempted adding extra #ifdef and #ifndef checks for _DEBUG mode on these lines, and changing the code accordingly, but with no success. Any help and guidance would be greatly appreciated! Many thanks Quote Win7 64-bit | Intel i7-3770 3.40GHz | NVIDIA GeForce GTX 660 Link to comment Share on other sites More sharing options...
reepblue Posted September 25, 2016 Share Posted September 25, 2016 In the current version of Leadwerks, you can disable the console window by putting this in main.cpp: // This will remove the cmd window from showing up with our window. #pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup") 3 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Roland Posted September 26, 2016 Share Posted September 26, 2016 In the current version of Leadwerks, you can disable the console window by putting this in main.cpp: // This will remove the cmd window from showing up with our window. #pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup") That was a nice one. I always have replaced the main with WinMain, changed the subsystem and fixed the argv stuff. This is far better. Great 1 Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Recommended Posts
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.