Today, someone asked an interesting question in the Israeli Metro forum I’m moderating.
The question was: “How can I know what’s the screen resolution in a Metro style app?”
This is a tricky answer, since:
- This capability has been removed from the RC.
- We can’t rely on current window Width and Height, since it may not be fully opened (snapping).
Well, searching a bit over the API’s, I didn’t find anything that can help, but, we can always use DirectX.
Creating a C++ Metro style application, here’s a code snippet demonstrating how to extract the screen resolution of a given display device:

Using DirectX, we can query for the IDXGIAdapter, then make a call the EnumOutputs, which provides information for output devices. From there, we can make a call for IDXGIOutput::GetDesc to get the device description. From there we can extract the screen resolution.
Now, to be able getting this value from a C# or JS application, we should create a simple WinRT object, placing it in a WinRT dll, then use it from other projects.
To create a WinRT object with C++, we should create a class which looks like this:

Feel free to download the code (MetroScreenRes.zip) for both the WinRT object and a C# tester.
Running the application, you can click on the Button and see your screen resolution. Changing the resolution and click the button again, you may see it updated.