Question about window dimensions.

closed account (3pj6b7Xj)
I was experimenting with the client area of a window today. I created the window and set the size to 1024x768 on my desktop. Upon using GetClientRect, I found the size of the client area to be 1018x740! All this time I've always thought that the client area of the window would be 1024x768 or what ever I requested but no, its the entire window that is that size and the client area is a completely different size. I pulled tons of hairs trying to figure out some things earlier and is what led me to this experiment.

So I am asking, is there any way to create a window and set the client area to the size you want? I know I could call a load of functions to get the width of the borders, the title bar, etc but that is tedious! There has to be an easier way!
AdjustWindowRect or AdjustWindowRectEx function.

http://msdn.microsoft.com/en-us/library/ms632665%28v=vs.85%29.aspx
Last edited on
closed account (3pj6b7Xj)
Man you are a god! Right on the bulls eye! Thanks! :)
All praise should go to MSDN

and Petzold
The techs at Microsoft quote Petzold when pointing out the correct way to do something, so I guess all the praise should just go to him!
closed account (3pj6b7Xj)
I bet that guy had his hands on the API the minute it came into existence, he must have devoted 90% of time to strict Win32 API programming. He really, really understands the way Win32 API behaves, awesome guy.
Before Windows was even released in 1985 Steve Balmer dumped a pile of disks at I believe the PC Magazine office in New York and Petzold ended up with them, and I believe wrote wrote the first article on Windows. You might want to check out his blog. It has some interesting stuff.
closed account (3pj6b7Xj)
So what your telling me is they wanted someone to do the job of documenting the API for them? That is rather interesting and misterious, Petzold must have peed his pants that day when he got his hands on all that info.
You are forgetting that in 1985 nobody knew anything about Microsoft Windows. The world was ruled by Macs and DOS. It definitely wasn't a forgone conclusion that Windows would even survive. Here's the Wikipedia link on CP...

http://en.wikipedia.org/wiki/Charles_Petzold

closed account (3pj6b7Xj)
Wow his close to me! I'm in Pennsylvania, its only a 2 hour drive to go see him, lLOL!
Topic archived. No new replies allowed.