#define WIN32_LEAN_AND_MEAN 的作用
作用 and Win32 define Mean
2023-09-11 14:19:34 时间
1:为什么要 #define WIN32_LEAN_AND_MEAN 。答案很简单,因为要包含尽量精简的内容,包含了这一句编译的时候明显快多了。
2:不加载MFC所需的模块。如果你的工程不使用MFC,就加上这句,这样一来在编译链接时,包括最后生成的一些供调试用的模块时,速度更快,容量更小。
3:我想这个不是 MFC 特有的, WIN32_LEAN_AND_MEAN 是针对 Win32 相关的头文件的, 比如在包含 WIN32/MFC SDK 头文件之前定义些宏, 可以通过预处理来关闭掉一些不太常用的系统接口或参数, 这样可以加快编译的速度!你可以看看 Windows.h 文件里和 WIN32_LEAN_AND_MEAN 相关的部分就明白了, 另外在这个文件开始部分一个注释, 这里有很多更详细的控制开关(宏)
In the Windows.h header, if WIN32_LEAN_AND_MEAN is not defined, the preprocessor will includes other headers. So if you want to not include theses headers, you must define WIN32_LEAN_AND_MEAN before #include , else it won't have any effects
#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 */
Directly from Windows.h
相关文章
- 【华为云技术分享】浅谈产品模型(Profile)在程序设计中的作用
- eclipes创建一个web项目web.xml不能自动更新的原因(web.xml和@WebServlet的作用)
- Maven介绍,包括作用、核心概念、用法、常用命令、扩展及配置
- C#[Serializable]在C#中的作用-NET 中的对象序列化
- 修改参数时scope参数值的作用
- oraInst.loc文件的作用
- 请说明一下MyBatis中命名空间(namespace)的作用是什么?
- reactjs虚拟DOM中key的作用及diffing算法
- 关于COMMIT WORK and COMMIT WORK AND WAIT在SAT中的讨论
- paip.Java Annotation注解的作用and 使用
- Cookie和Session的作用,区别和各自的应用范围,Session工作原理
- Qt 关于QT_BEGIN_NAMESPACE宏的作用
- JDBC 中 socketTimeout 的作用
- sql STRING_AGG 作用优先级
- form表单标签的enctype属性的作用