Sign in to follow this  
lonewolff

Is it possible to detect desktop resolution

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this