0

I need current display resolution. How can i get this? I know about Window.Current.Bounds, but application can worked in windows mode.

  • Possible duplicate of [Get Screen Resolution in Win10 UWP App](http://stackoverflow.com/questions/31936154/get-screen-resolution-in-win10-uwp-app) – Justin XL Oct 20 '15 at 11:30
  • Thank you for answer, but this solution is suitable for Windows Phone(Mobile). In windows desktop VisibleBounds is not available. – Nikolay Oct 20 '15 at 15:26
  • 1
    Here it is: http://stackoverflow.com/questions/10828179/how-to-get-the-resolution-of-screen-for-a-winrt-app – marcinax Oct 20 '15 at 21:09

1 Answers1

0

what do you mean VisibleBounds is not working on Deskptop? I tried in my win10 UWP program, it works fine. I can get my desktop resotion like below:

  var bounds = ApplicationView.GetForCurrentView().VisibleBounds;
  var scaleFactor = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;
  var size = new Size(bounds.Width * scaleFactor, bounds.Height * scaleFactor);

Besides, if you are using DX in store app, you can create an IDXGIFactory object and use it to enumerate the available adapters. Then call IDXGIOutput::GetDisplayModeList to retrieve an array of DXGI_MODE_DESC structures and the number of elements in the array. Each DXGI_MODE_DESC structure represents a valid display mode for the output. e.g.:

   UINT numModes = 0;
   DXGI_MODE_DESC* displayModes = NULL;
   DXGI_FORMAT format = DXGI_FORMAT_R32G32B32A32_FLOAT;

    // Get the number of elements
    hr = pOutput->GetDisplayModeList( format, 0, &numModes, NULL);

    displayModes = new DXGI_MODE_DESC[numModes]; 

    // Get the list
    hr = pOutput->GetDisplayModeList( format, 0, &numModes, displayModes);

Please let me know if you need further information.

Fangfang Wu - MSFT
  • 1,062
  • 6
  • 7