Jump to content
  • Advertisement
Sign in to follow this  
DividedByZero

Is it possible to detect desktop resolution

This topic is 3660 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is is possible to detect what resolution a user's desktop is before creating a render window? For example, on one PC my normal resolution is 1440 x 900 and the other is 1024 x 768. I want my app to automatically initialise the render window to the appropriate desktop resolution without the user having to prompt to do it. If so, is the process the same for DX9 & 10 Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
Yes this is possible, the easiest way in C/C++ is using GetSystemMetrics(SM_CXSCREEN) and GetSystemMetrics(SM_CYSCREEN), for the width and height respectively.
If you want to enable the user to choose a different screen you have to use different methods. You can use the GetMonitorInfo function to get information about a monitor. Look up the MSDN page for additional information.

EDIT: Depending on how you create your device this can be handled automatically for you, with different screens taken into account by the API. Check some of the examples that comes with the SDK, the framework they use fix these things and comes with source.
For example by simply creating your device with D3D10CreateDeviceAndSwapChain in windowed mode, it will automatically use the correct resolution when switching to fullscreen. I often use this since it's easy.

Share this post


Link to post
Share on other sites
That will probably be the method I am after.

I am planning on having my app full-screen when it is complete. So, while in a debugging window mode, i'll probably just use half or three quarter screen resolution.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!