문제

I am planning to write a piece of code using the media foundation API which is available after vista. I want to add the code inside a #if block something like...

#if <SomeMacro>
// all the classes using MediaFoundation go here.
#endif

I could not find a macro to detect the operating system version. How is this normally done on windows?? I found _WIN32 and _WIN64 to detect 32-bit and 64-bit but no macros to determine api availability. Is there a better way of isolating code based on API availability in vc..?

Thanks, Abhinay.

도움이 되었습니까?

다른 팁

Not really. The best you can do is to key off the WIN32_WINNT macro, but that doesn't help you if someone turns around and tries to run your application on XP.

Try the _WIN32_WINNT and WINVER macros. More info here: http://msdn.microsoft.com/en-us/library/aa383745%28VS.85%29.aspx

Try something like,

#ifdef _WIN32_WINNT_VISTA
    #if WINVER >= _WIN32_WINNT_VISTA
        //....
    #endif
#endif
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top