代码之家  ›  专栏  ›  技术社区  ›  Kirill V. Lyadvinsky

如何控制Windows标题(有用的定义)?

  •  17
  • Kirill V. Lyadvinsky  · 技术社区  · 17 年前

    其中一个答案是 this 问题 jalf 谈到有用的定义 NOMINMAX ,这可以防止不需要定义最小/最大宏。是否有其他有用的定义可以帮助控制 windows.h (或其他Windows头文件,例如Microsoft C运行时头文件或STL实现)行为?

    2 回复  |  直到 10 年前
        1
  •  24
  •   Cat Plus Plus    17 年前

    最常用的可能是 WIN32_LEAN_AND_MEAN -它禁用很少使用的API部分。您可以在msdn上找到更多信息 Using the Windows Headers .

    我记错了有关msdn列出这些定义的内容,下面是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
     */
    
        2
  •  3
  •   user7116    17 年前

    MFC项目可以使用 VC_EXTRALEAN 自从 WIN32_LEAN_AND_MEAN 已由MFC定义。我也推荐 enabling STRICT .