This section of the archives stores flipcode's complete Developer Toolbox collection, featuring a variety of mini-articles and source code contributions from our readers.

 

  Win32 Console/Windowed Tip
  Submitted by



This is a little include file for MSVC Win32 platforms. It can be used if you want to disable your CONSOLE in your application. Say you have some OpenGL example (like the ones from GLUT, and you want to make them without CONSOLE, and by the same way keeping them portable - e.g. calling main() and getting argc, argv, instead of calling WinMain)

This also allows WinMain() programs to have their console open (sometimes is useful). That's all folks.

Should work fine with UNICODE applications

malkia



#ifndef __WIN32CONSOLE_INCLUDED
#define __WIN32CONSOLE_INCLUDED

/****************************************************************

compile with -DWIN32CONSOLE=1 to have console and -DWIN32CONSOLE=0 to hide console -- default

compile with -DWIN32WINMAIN=1 to start from WinMain() and -DWIN32WINMAIN=0 to start from main() -- default

by: malkia/eastern.analog malkia@mindless.com malkia@digitald.com url: http://EasternAnalog.hypermart.net url: www.digitald.com Have effect only with MSVC 5.0+ when target platform is WIN32 and <windows.h being included. I didn't test it on other compilers..

****************************************************************/


#if defined(_MSC_VER) && defined(_WIN32) #if WIN32WINMAIN #if _UNICODE #pragma comment(linker,"/ENTRY:wWinMainCRTStartup") #else #pragma comment(linker,"/ENTRY:WinMainCRTStartup") #endif #else #if _UNICODE #pragma comment(linker,"/ENTRY:wmainCRTStartup") #else #pragma comment(linker,"/ENTRY:mainCRTStartup") #endif #endif

#if WIN32CONSOLE #pragma comment(linker,"/SUBSYSTEM:CONSOLE") #else #pragma comment(linker,"/SUBSYSTEM:WINDOWS") #endif #endif /* _MSC_VER, _WIN32 */

#endif /* __WIN32CONSOLE_INCLUDED__ */

The zip file viewer built into the Developer Toolbox made use of the zlib library, as well as the zlibdll source additions.

 

Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.