本文介绍了dxvahd.h中的#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)Microsoft头文件何时变为true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有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 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)"

而在另一个解决方案 B中,此条件#if为true,因此没有问题与

Whereas in another solution "B", this conditional #if is true,hence no issues & its working fine.

有人可以让我知道如何在解决方案 A中解决此问题,其中上面的#if变灰了/不编译。 PLz帮帮我。

谢谢。

推荐答案

查看,您会看到这些宏用于确定您拥有的平台以及适合您的平台的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中的#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)Microsoft头文件何时变为true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 07:30