How to tame the Windows headers (useful defines)?

后端 未结 2 868
死守一世寂寞
死守一世寂寞 2020-12-03 00:03

In one of the answers to this question jalf spoke about useful define NOMINMAX, that could prevent from unwanted defining min/max macros. Are there other useful

相关标签:
2条回答
  • 2020-12-03 00:18

    MFC projects can use VC_EXTRALEAN since WIN32_LEAN_AND_MEAN is already defined by MFC. I also recommend enabling STRICT.

    0 讨论(0)
  • 2020-12-03 00:25

    The most commonly used is probably WIN32_LEAN_AND_MEAN - it disables rarely used parts of the API. You can find more on MSDN's Using the Windows Headers.

    I remembered wrong about MSDN listing those defines, so here's list from windows.h:

    /*  If defined, the following flags inhibit definition
     *     of the indicated items.
     *
     *  NOGDICAPMASKS     - CC_*, LC_*, PC_*, CP_*, TC_*, RC_
     *  NOVIRTUALKEYCODES - VK_*
     *  NOWINMESSAGES     - WM_*, EM_*, LB_*, CB_*
     *  NOWINSTYLES       - WS_*, CS_*, ES_*, LBS_*, SBS_*, CBS_*
     *  NOSYSMETRICS      - SM_*
     *  NOMENUS           - MF_*
     *  NOICONS           - IDI_*
     *  NOKEYSTATES       - MK_*
     *  NOSYSCOMMANDS     - SC_*
     *  NORASTEROPS       - Binary and Tertiary raster ops
     *  NOSHOWWINDOW      - SW_*
     *  OEMRESOURCE       - OEM Resource values
     *  NOATOM            - Atom Manager routines
     *  NOCLIPBOARD       - Clipboard routines
     *  NOCOLOR           - Screen colors
     *  NOCTLMGR          - Control and Dialog routines
     *  NODRAWTEXT        - DrawText() and DT_*
     *  NOGDI             - All GDI defines and routines
     *  NOKERNEL          - All KERNEL defines and routines
     *  NOUSER            - All USER defines and routines
     *  NONLS             - All NLS defines and routines
     *  NOMB              - MB_* and MessageBox()
     *  NOMEMMGR          - GMEM_*, LMEM_*, GHND, LHND, associated routines
     *  NOMETAFILE        - typedef METAFILEPICT
     *  NOMINMAX          - Macros min(a,b) and max(a,b)
     *  NOMSG             - typedef MSG and associated routines
     *  NOOPENFILE        - OpenFile(), OemToAnsi, AnsiToOem, and OF_*
     *  NOSCROLL          - SB_* and scrolling routines
     *  NOSERVICE         - All Service Controller routines, SERVICE_ equates, etc.
     *  NOSOUND           - Sound driver routines
     *  NOTEXTMETRIC      - typedef TEXTMETRIC and associated routines
     *  NOWH              - SetWindowsHook and WH_*
     *  NOWINOFFSETS      - GWL_*, GCL_*, associated routines
     *  NOCOMM            - COMM driver routines
     *  NOKANJI           - Kanji support stuff.
     *  NOHELP            - Help engine interface.
     *  NOPROFILER        - Profiler interface.
     *  NODEFERWINDOWPOS  - DeferWindowPos routines
     *  NOMCX             - Modem Configuration Extensions
     */
    
    0 讨论(0)
提交回复
热议问题