5

안녕하세요. 저는 두 개의 VC++ 솔루션 "A"를 가지고 있습니다. & "B"(VS2008) 둘 다 동일한 코드베이스를 가지고 있습니다. 다른). 둘 다 DXVAHD.h 사용.dxvahd.h의 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)은 Microsoft 헤더 파일이 참이 됨

dxvahd.h는 표준 Microsoft 헤더 파일입니다. 우리는이 헤더 파일을 열 경우, 우리는 "#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)는"

내가 VC++ 솔루션 "A"에서, 위의 조건의 #if 문 는, 따라서 전체 dxvahd 헤더 파일 거짓임을 알 조건부 경우가 참조 회색으로되다 &은 도 컴파일되지 않습니다 !!

반면에이 조건문 #if는 참이므로이 문제는 아무런 문제가 없습니다. & 잘 작동합니다.

누구나 친절하게 해결책 "A"에서이 문제를 해결할 수 있습니까? 위의 #if는 회색으로 표시되고 컴파일되지 않습니다. PLZ 도와주세요.

미리 감사드립니다.

답변

7

winapifamily.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) 

WINAPI_PARTITION_DESKTOP은 시스템의 데스크톱 제품군에서 실행중인 경우에만 설정됩니다.

+0

그러나 솔루션 "A"와 "B"는 모두 같은 시스템, 동일한 OS, 동일한 플랫폼에서 컴파일 및 실행됩니다. VS2008의 2 가지 솔루션의 차이를 유발하는 설정이 될 수 있는지 궁금합니다. – codeLover

+0

@codeLover AFAIK 이것은 Metro 응용 프로그램과 Desktop 응용 프로그램을 비교 한 것입니다. 마지막으로 검사했을 때 VS2008에서 Metro가 지원되지 않았습니다. 내가 잘못? –

+0

두 솔루션을 모두 데스크톱 Win7에서 실행 중이며 둘 다 데스크톱 앱입니다. – codeLover

0

WINAPI_FAMILY도 대상 Windows 버전에 따라 설정됩니다.

this discussion과 연결된 blog post series을 참조하십시오. 당신이 다음 (승 8> = 용)에 "응용 프로그램"을 작성하지 않는 경우 특히

이 :

표준 _WIN32_WINNT 윈도우의 사용은 올바른 Win32 API를을 선택하는 정의 안함 (예 : 많은 윈도우 스토어 애플리케이션에 사용하기 위해 필요는 Win32 API는 비스타 (0x0600), 윈도우 7 (0x0601), 또는 윈도우 8 (0x0602) 버전입니다.

당신은 WINVER or _WIN32_WINNT를 사용할 수 있습니다.