什么时候微软头文件中的#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESK
When does #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) in dxvahd.h Microsoft header file become true
嗨,我有两个vc++解决方案"A" &"B"(VS2008)都有相同的代码库(只有几行代码不同)。
dxahd .h是一个标准的Microsoft头文件。如果我们打开这个头文件,我们会看到有一个条件If" #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
"
我看到在vc++解决方案"A"中,上面的条件#if语句为false,因此整个dxhd头文件变灰&不是即使编译! !
而在另一个解决方案"B"中,这个条件#if为真,因此没有问题&
谁能让我知道我如何在解决方案"A"中解决这个问题,其中上面的#if正在变灰/不编译。
查看winapiffamily .h,您可以看到这些宏用于确定您使用的平台以及适合您的平台的API。
/*
* Windows APIs can be placed in a partition represented by one of the below bits. The
* WINAPI_FAMILY value determines which partitions are available to the client code.
*/
#define WINAPI_PARTITION_DESKTOP 0x00000001
#define WINAPI_PARTITION_APP 0x00000002
/*
* A family may be defined as the union of multiple families. WINAPI_FAMILY should be set
* to one of these values.
*/
#define WINAPI_FAMILY_APP WINAPI_PARTITION_APP
#define WINAPI_FAMILY_DESKTOP_APP (WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_APP)
/*
* A constant that specifies which code is available to the program's target runtime platform.
* By default we use the 'desktop app' family which places no restrictions on the API surface.
* To restrict the API surface to just the App API surface, define WINAPI_FAMILY to WINAPI_FAMILY_APP.
*/
#ifndef WINAPI_FAMILY
#define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP
#endif
/* Macro to determine if a partition is enabled */
#define WINAPI_FAMILY_PARTITION(Partition) ((WINAPI_FAMILY & Partition) == Partition)
/* Macro to determine if only one partition is enabled from a set */
#define WINAPI_FAMILY_ONE_PARTITION(PartitionSet, Partition) ((WINAPI_FAMILY & PartitionSet) == Partition)
因此,只有在系统的Desktop系列上运行时才会设置WINAPI_PARTITION_DESKTOP
。
WINAPI_FAMILY也根据目标Windows版本进行设置。
请参阅此讨论和链接的博客文章系列。
特别是,如果你不是在写一个"App"(for>= win8),那么:
首选使用标准的_WIN32_WINNT Windows定义进行选择正确的Win32 API(即许多Win32 API需要在Windows商店应用程序是Vista (0x0600), Windows 7 (0x0601),或Windows 8 (0x0602)版本。
您可以使用WINVER或_WIN32_WINNT
相关文章:
- WinAPI挂钩鼠标
- 将执行、作业和WinAPI相乘
- 如何在桌面C++上使用 WinApi 画线
- WINAPI 注册应用程序重新启动时不清除打开的套接字
- Winapi:屏幕截图未显示在窗口中
- WinAPI 在单击第一个对话框上的按钮控件并销毁第一个对话框后创建第二个对话框
- Qt with WinAPI MouseProc
- 如何在"SUBSYSTEM:WINDOWS"下显示并输出到Windows(C++ WinApi)上的
- WinAPI 无法创建按钮
- std::partition segfault issue
- 将 Win32/WinAPI 应用程序移植到 wxWidgets
- WinAPI 检查窗口是否具有常规标题栏
- 如何使用带有矢量的 winapi 读取进程内存从另一个进程读取缓冲区?
- 将Qt集成到现有的VS项目中以取代WinAPI
- __stdcall - WINAPI vs STDMETHODCALLTYPE vs APIENTRY
- 如何将'this'指针传递给C++ WinAPI 线程?
- Winapi-WM_CLOSE的替代方案
- Winapi - SetWindowLongPtr in ShutdownBlockReason创建/销毁JNI本机代码
- WinAPI C++如何从 64 位应用程序加载资源
- winapi 中的哪个功能检查按钮是否正在关闭控制台?