宏WIN32_LEAN_AND_MEAN

作用


 定义于windows.h文件中,定义如下

#ifndef WIN32_LEAN_AND_MEAN
    #include <cderr.h>
    #include <dde.h>
    #include <ddeml.h>
    #include <dlgs.h>
    #ifndef _MAC
        #include <lzexpand.h>
        #include <mmsystem.h>
        #include <nb30.h>
        #include <rpc.h>
    #endif
    #include <shellapi.h>
    #ifndef _MAC
        #include <winperf.h>
        #include <winsock.h>
    #endif
    #ifndef NOCRYPT
        #include <wincrypt.h>
        #include <winefs.h>
        #include <winscard.h>
    #endif

    #ifndef NOGDI
        #ifndef _MAC
            #include <winspool.h>
            #ifdef INC_OLE1
                #include <ole.h>
            #else
                #include <ole2.h>
            #endif /* !INC_OLE1 */
        #endif /* !MAC */
        #include <commdlg.h>
    #endif /* !NOGDI */
#endif /* WIN32_LEAN_AND_MEAN */

定义这个宏,将不加载一些少用的头文件

最大作用是不加载winsock.h

因为winsock.h和winsock2.h冲突

起源


 windows从16位向32位过渡时引入

定义这个宏,程序员可以像在16位系统那样编程:仅加载编写基础框架需要的头文件

原文地址:https://www.cnblogs.com/sqxy110/p/4991585.html