Windows Phone 8.1 and Windows Runtime Apps How to #6 – How to Detect the Current device Platform in Windows Universal App ?

When working with the Windows Universal App , it may be necessary for the developers sometimes to check if the target device is phone or windows 8 tablet and write the platform dependent code based on the criteria.

How to Detect the Current device Platform in Windows Universal App ?

You can use the #ifdef directives WINDOWS_APP and WINDOWS_PHONE_APP for this scenario.

Eg :

#if WINDOWS_PHONE_APP
    // Its a Windows Phone app
#endif
#if WINDOWS_APP
    // Its a Windows 8 app
#endif

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this post, you’ll learn about the Win32 Error “0x000019E5 – ERROR_COULD_NOT_RESIZE_LOG” that you get when debugging system erors in...
In this post, you’ll learn about the error “CO_E_DBERROR 0x8004E02B” that is returned when working with COM based APIs or...
In this post, you’ll learn about the Win32 Error “0x000019D0 – ERROR_LOG_BLOCK_VERSION” that you get when debugging system erors in...