I needed to find out the height of the screen in order to resize a dialog. I am calling GetSystemMetrics
with SM_CYFULLSCREEN
and I am getting a certain number (1028 in my case). Per MSDN:
To get the coordinates of the portion of the screen not obscured by the system taskbar or by application desktop toolbars, call the
SystemParametersInfo
function with theSPI_GETWORKAREA
value.
I called SystemParametersInfo
as well to see what it returns and I get a different number for the height, 1050. Running spy, the area without taskbar is indeed of height 1050. Does anyone know why the different heights? Thanks
From the MSDN docs for SM_CYFULLSCREEN:
Relevant detail bolded, the client area is the part of the window without the borders and title bar. It is therefore substantially less than the actual primary screen height. Perhaps you meant to use SM_CYSCREEN instead. SPI_GETWORKAREA returns the available space for the entire window, the outer size, the one you'd pass to CreateWindowEx().