Screen Resolution in Win32

Recommended Posts

I am developing a tool whose window can be resized. In order to keep from having to reset the D3D device I was thinking I would set the back buffer size to be the screen resolution so that there would be plenty of room to resize the window, and then just update the viewport upon resizing. The problem is, when I initialize the device and specify the back buffer size in the D3DPRESENT_PARAMETERS, I can't find a way to get the current screen resolution in Win32 to initialize the back buffer. Anyone know how to do this? Thanks

Share on other sites
Aardvajk    13207
As an alternative to MJP's solution, if you want to retrieve this prior to creating your IDirect3D9 object, you can use GetSystemMetrics() from the Win32 API like follows:

#include <windows.h>int main(){    int x=GetSystemMetrics(SM_CXSCREEN);    int y=GetSystemMetrics(SM_CYSCREEN);}

HTH