简体   繁体   中英

Detecting Windows Phone version in C++ or C++/CX

It seems that Windows Media Foundation works slightly different in Windows 8.1.

And we need to add some code that looks like this:

#if WINDOWS_81
    DX::ThrowIfFailed(
        MFStartup(MF_VERSION)
        );
#endif

How can we check to see what version of Windows Phone is running via C++?

Thanks!

You can use WINVER to see / control which version the build is targeting at command time. See Using the Windows Headers .

// 0x0603 for Windows / Windows Phone 8.1
#if WINVER >= 0x0603
    DX::ThrowIfFailed(
        MFStartup(MF_VERSION)
        );
#endif

If the only reason is for the MFStartup check then you can leave out the conditional. It is required for 8.1, but it should work fine for 8.0.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM