how to get users screen size

Started by
7 comments, last by Pirosan 19 years, 8 months ago
hey i was wondering if there is a simple function to determin the size of the user's window, so i can set the window to the correct size when i fullscreen the app? (in direct x or just c++) thanks, Chris
Bow before me... for i am l33t!
Advertisement
Two options:
ScreenWidth = GetSystemMetrics(SM_CXFULLSCREEN);ScreenHeight = GetSystemMetrics(SM_CYFULLSCREEN);

or IDirect3D9::GetAdapterDisplayMode
hm it says that it fails to create the device when and only when i use that function, i use the same function in non full screen and it has the same effect as if i used normal numbers..

EDIT: im using your first idea
Bow before me... for i am l33t!
after i did some debugging i noticed that the height was wronge. my computer is 1280 by 800 and the dimentions returned were 1280 by 740

any ideas?
Bow before me... for i am l33t!
in fact, if i go into 800x600 mode it returns the height as 540... so its always 60 off, but why?
Bow before me... for i am l33t!
sounds like its taking into account the taskbar or something like that... use SM_CYVIRTUALSCREEN and SM_CXVIRTUALSCREEN instead
SM_CYFULLSCREEN and SM_CYSCREEN both return the wrong values for me [in winxp], i think microsoft changed the behaviour of this and forgot to tell us, cause their documentation makes it sound like you are getting the FULL screen area not the full screen area minus the taskbar.....
yep, it seems they did change the behaviour of SM_CYSCREEN, just tried in win98 SE and it worked fine....
yeah it worked! thanks for the help, this is definitly a good thing to have in my engine, and it will really make things easier.


Chris
Bow before me... for i am l33t!

This topic is closed to new replies.

Advertisement