#defining WIN32

编程入门 行业动态 更新时间:2024-10-28 13:18:06
本文介绍了#defining WIN32_LEAN_AND_MEAN 究竟排除了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我发现定义 WIN32_LEAN_AND_MEAN 的解释通过排除一些不常用的 API 来减小 Win32 头文件的大小".我在其他地方读到它加快了构建过程.

那么 WIN32_LEAN_AND_MEAN 究竟排除了什么?我应该关心这个预处理器指令吗?它会加快构建过程吗?

我还在项目中看到了一个预处理器指令,它以额外精益的方式命名.这是我应该知道的另一个深奥的预处理器咒语吗?

解决方案

直接来自 Windows.h 头文件:

#ifndef WIN32_LEAN_AND_MEAN#include #include #include #include #ifndef _MAC#include #include #include #include #万一#include #ifndef _MAC#include #include #万一#ifndef NOCRYPT#include #include #include #万一#ifndef NOGDI#ifndef _MAC#include #ifdef INC_OLE1#include 

#别的#include

#endif/* !INC_OLE1 */#endif/* !MAC */#include #endif/* !NOGDI */#endif/* WIN32_LEAN_AND_MEAN */

如果您想知道每个标头的实际作用,请在 MSDN 库通常会生成该头文件中的函数列表.

此外,来自 Microsoft 的支持页面:

<块引用>

为了加快构建过程,Visual C++ 和 Windows 头文件提供了以下新定义:

VC_EXTRALEAN
WIN32_LEAN_AND_MEAN

您可以使用它们来减小 Win32 头文件的大小.

最后,如果您选择使用这些预处理器定义中的任何一个,并且缺少您需要的某些内容,您可以自己包含该特定头文件.在 MSDN 中输入您要使用的函数的名称通常会生成一个条目,如果您想使用它,该条目会告诉您应包含哪个标题,位于页面底部.

I found the explanation defining WIN32_LEAN_AND_MEAN "reduces the size of the Win32 header files by excluding some of the less frequently used APIs". Somewhere else I read that it speeds up the build process.

So what does WIN32_LEAN_AND_MEAN exclude exactly? Should I care about this pre-processor directive? Does it speed up the build process?

I've also seen a pre-processor directive in projects named something along the lines of extra lean. Is this another esoteric pre-processor incantation I should know about?

解决方案

Directly from the Windows.h header file:

#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 */

if you want to know what each of the headers actually do, typeing the header names into the search in the MSDN library will usually produce a list of the functions in that header file.

Also, from Microsoft's support page:

To speed the build process, Visual C++ and the Windows Headers provide the following new defines:

VC_EXTRALEAN
WIN32_LEAN_AND_MEAN

You can use them to reduce the size of the Win32 header files.

Finally, if you choose to use either of these preprocessor defines, and something you need is missing, you can just include that specific header file yourself. Typing the name of the function you're after into MSDN will usually produce an entry which will tell you which header to include if you want to use it, at the bottom of the page.

这篇关于#defining WIN32_LEAN_AND_MEAN 究竟排除了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-27 16:20:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1158543.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:defining

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!