A little trick when setting up a non-resizeable window is to determine your Client area (the inside of the window) according to controls you are inserting... Once you know how much space the controls need, you can calculate the window size quite easily. It doesn't actually matter what the units of measurement are, so long as you use them consistently (But, you are correct that for a non-dialog window it is Pixels).
Here's an example:
Code:
// calculate main window size
ww = bs * 8; // width of client area
wh = (bs * 2) + 28; // height of client area
// size display and buttons
MoveWindow(Wind[1],2,2,ww-4,25,1);
// relocate toolbars
MoveWindow(Wind[2],0,28,ww,bs,1);
MoveWindow(Wind[3],0,bs + 28,ww,bs,1);
// calculate window rect
GetWindowRect(Wind[0],&wr);
wr.right = ww + (GetSystemMetrics(SM_CXFIXEDFRAME) * 2);
wr.bottom = wh + (GetSystemMetrics(SM_CYFIXEDFRAME) *2)
+ GetSystemMetrics(SM_CYCAPTION);
// resize window
MoveWindow(Wind[0],wr.left,wr.top,wr.right,wr.bottom,1);
In the example I've already created all my windows Wind[0] is the main window, Wind[1] is a small message window... Wind[2] and Wind[3] are toolbars. Now I need to wrap my main window around my display and rows of buttons. I know the button sizes so I can easily calculate the width and height I need for my client area and adjust 1, 2, and 3 to suit. From there it's a matter of querying the system for border sizes etc. and then finally adjusting the size of the main window to suit.
A scheme like this gives you the right size even if the user changes the border width, caption size etc. or switches to "classic view" where the borders are just thin lines.
I've attached a screen shot of the result...
Resizeable windows are a whole different animal...