When does #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) in dxvahd.h Microsoft header file become true(dxvahd.h Microsoft 头文件中的#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 何时变为真)
问题描述
您好,我有 2 个 VC++ 解决方案A"和B"(VS2008)都具有相同的代码库(只有几行代码不同).在两者中都使用 DXVAHD.h.
Hi I am having 2 VC++ solutions "A" & "B" (VS2008) both are having the same codebase (with just few lines of code different). Using DXVAHD.h in both.
dxvahd.h 是一个标准的 Microsoft 头文件.如果我们打开这个头文件,我们会看到有一个条件 if"#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
"
dxvahd.h is a standard Microsoft header file. If we open this header file, we see there is a conditional if
"#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
"
我看到在 VC++ 解决方案A"中,上面的条件 #if 语句是假的,因此整个 dxvahd 头文件变灰 &不是甚至编译!
I see that in VC++ solution "A", the above conditional #if statement is false, hence the whole dxvahd header file gets greyed out & is not even compiled!!
而在另一个解决方案B"中,这个条件 #if 为真,因此没有问题 &它工作正常.
Whereas in another solution "B", this conditional #if is true,hence no issues & its working fine.
谁能告诉我如何在解决方案A"中解决此问题,其中上述#if 变灰/未编译.请帮助我.
提前致谢.
推荐答案
看winapifamily.h,您可以看到这些宏用于确定您拥有什么平台以及哪些 API 适合您的平台.
Looking at winapifamily.h, you can see that these macros are used to determine what platform you have and what API's are suitable for your platform.
/*
* 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)
因此,只有在系统的桌面系列上运行时,才会设置您的 WINAPI_PARTITION_DESKTOP
.
So your WINAPI_PARTITION_DESKTOP
would only be set if you are running on a Desktop family of the the system.
这篇关于dxvahd.h Microsoft 头文件中的#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 何时变为真的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:dxvahd.h Microsoft 头文件中的#if WINAPI_FAMILY_PARTITION
基础教程推荐
- 什么是T&&(双与号)在 C++11 中是什么意思? 2022-11-04
- 如何在 C++ 中处理或避免堆栈溢出 2022-01-01
- 运算符重载的基本规则和习语是什么? 2022-10-31
- 设计字符串本地化的最佳方法 2022-01-01
- C++ 程序在执行 std::string 分配时总是崩溃 2022-01-01
- C++,'if' 表达式中的变量声明 2021-01-01
- C++ 标准:取消引用 NULL 指针以获取引用? 2021-01-01
- 如何定义双括号/双迭代器运算符,类似于向量的向量? 2022-01-01
- 调用std::Package_TASK::Get_Future()时可能出现争用情况 2022-12-17
- 您如何将 CreateThread 用于属于类成员的函数? 2021-01-01