locked
Get the Screen resolution configured in control panel

    Question

  • Hi!

    I am just writing a metro app which has one page to display current device information including screen resolution and screen physical dimensions.

    I am trying by different ways suggested by different forums including Screen.PrimaryScreen, CurrentWIndow.Bounds etc. But I think all of them return resolution used by current app and not the display resolution seen in control panel->Display->Resolution.

    Because none of the values match with whats seen in control panel.

    Is there an API to get it from display screen directly?

    Thanks,

    Pratibha

    Monday, July 21, 2014 7:38 PM

Answers

All replies

  • Hi,

    There is no direct API in windows store app can get device resolution in control panel. But I found a blog which may be can help you:

    http://blogs.microsoft.co.il/tomershamam/2012/07/24/get-screen-resolution-in-windows-8-metro-style-application/

    The blog using DirectX, which 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.

    Hope that can help you!

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Tuesday, July 22, 2014 2:19 AM
  • Hi Anne,

    Thanks a lot for responding.

    It did work when I execute it on my local machine which is of X64 architecture.

    But when I try to create an app package for the same, I get processor architecture error.

    The architecture of my WInRT app is win32 by default. It works with that on my local X64 machine.

    But if I change the target type of this WInRT project, it gives error of not finding CreateDevice API.

    Please help,

    Thanks,

    Pratibha

    Wednesday, July 23, 2014 12:03 AM
  • Hi,

    I see the project. The project create a windows runtime component with C++. And then use the component in windows store app C# project. You can refer to the links:

    Creating Windows Runtime Components in C++

    Walkthrough: Creating a basic Windows Runtime component in C++ and calling it from JavaScript or C#

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Wednesday, July 23, 2014 2:31 AM