Menu

(Win32) What are this #defines for?

2003-01-01
2012-09-26
  • Nobody/Anonymous

    Ive seem some sources for Win32 projects that include one of the following lines:
    #define WIN32_LEAN_AND_MEAN 
    #define _WIN32_IE >= 0x0300                            
    #define _WIN32_IE 0x0400
    #define _WIN32_IE 0x0600
    Can you tell me what are they for and when to use them?

     
    • Nobody/Anonymous

      Lean and mean means "good".

       
    • Nobody/Anonymous

      lean and mean leaves out a bunch of rarely needed headers when compiling.. speeds things up.

      the WIN32_IE ones are to tell the compiler which version of Internet Explorer to compile for, depending on which you put it will leave out things that aren't supported by that version, for instance if you put 0x0300 it won't include the stuff for common dialogs.

      balckadder

       
    • Patrick Ogay

      Patrick Ogay - 2003-01-01

      generally speaking:
      with #define you may influence the behavior of your compiler.

      /* avoid MFC in existing Programs and compiler differences */
      #define CString string 
      #define ASSERT assert
      #define TRACE0  _mylog

      many Preprocessor variables are used by the "system".
      And if you have a error in  " neverseen.h"  mostly a define is wrong :-)  maybe "windows.h" is missing or compilerflag not set.

      Sometimes it might be useful, to use Flags if you need a conditonal compilation, for debugging options and so on. So you can avoid, that all DLL's have to be loaded during execution and so on.
      like:
      the variables you can influence with compiler-input
      as -D_myGUI   ( link GTK+ to application)

      As you see it's quit tricky.
      I hope you got a idee about #define
      in C++ you should prefer things like templates and inheritance, and keep defines to a minimum.

      Patrick
      Look  at the example of a header.file,
      avoid multiple call during compiletime, handling of c and C++ differences...very nice an maintainable code ;-)

      #ifndef infra_h
      #define infra_h
      // -------------------
      // example
      /* os-versions */
      #ifdef unixsolaris
      #include special_includes.h 
      #elifdef  hp_unix
      #endif  /* unix os */
      /* debugging */
      #ifdef  _debug
      #include debug.h
      #endif
      /* GUI
      #ifdndef _NOGUI
      #include <gtk.h>  /* and so on */
      #endif

      #endif    /* infra_h */

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.