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
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?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
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.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
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
Last edited by novacain; 10-15-2007 at 12:27 AM.
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill