Hi I am trying to find some function which would return a lenght and height of current window in pixels... I tried GetSystemMetrics() but it didnt work properly...
Is there any other way how to find out these two values?
Thx
Printable View
Hi I am trying to find some function which would return a lenght and height of current window in pixels... I tried GetSystemMetrics() but it didnt work properly...
Is there any other way how to find out these two values?
Thx
Isn't there a getClientRect type function?
Yes. And GetWindowRect. A search would've found both.
See also SystemParametersInfo(SPI_GETWORKAREA flag) if you just need to adjust GetSystemMetrics results to account for the taskbar.
Thanks for that tidbit Ken, I knew there had to be a simpler way. Up until now, I had been using:
y = GetSystemMetrics(SM_CYVIRTUALSCREEN) to get the height of the window
hTaskBar = FindWindow("Shell_TrayWnd") to find the handle to the taskbar/tray
GetWindowRect(hTaskBar, &trayRect)
and finally,
WorkAreaY = y - (trayRect.top - trayRect.bottom)
While were on the topic of insanely complex methods of handling relatively simple problems, would you know a simple way of how to set a window's client size? So far I've been using SetWindowPos(), but since this uses total size, I have to then compensate for title bar thickness by calling GetTitleBarInfo().rcTitleBar.(bottom - top) first :S