   Win32 and window sizing
  Hi folks,  I'm piling through a tutorial done by Evil_Greven back in 03 for a 1hr Tetris clone. I was hoping someone could shed some light on the why's of the below code.//set the client area sizeRECT rcTemp;SetRect(&rcTemp,0,0,MAPWIDTH*TILESIZE+TILESIZE*GREY,MAPHEIGHT*TILESIZE);//160x480 client areaAdjustWindowRect(&rcTemp,WS_BORDER | WS_SYSMENU | WS_CAPTION| WS_VISIBLE,FALSE);//adjust the window size based on desired client areaSetWindowPos(hWndMain,NULL,0,0,rcTemp.right-rcTemp.left,rcTemp.bottom-rcTemp.top,SWP_NOMOVE);//set the window width and heightI get that you need to create the rectangle structure to pass it as an argument for resizing the window but why the two next function calls. I have two guesses. Lets see if either is correct. 1. The client area is different than the "window" so AdjustWindoRect is resizing the "inside" of the window and SetWindowPos is resizing the outside?2. AdjustWindowRect is setting the dimensions for the window in memory but it won't be drawn ( or visible ) until the function call SetWindowPos. Are either of those guesses accurate?Thanks much,Donovan   
  In Win32, CreateWindowEx() and SetWindowPos() take the windows size in terms of the "window rect", which is the actual border of the window including the nonclient area. The client area size is then dependent on the window rect that you specified and the style of the window e.g. some window's have a title bar so the client area will be smaller vertically in a such a window relative to a window with the same window rect but no title bar, etc. However often what you care about is the size of the client area. So this is what AdjustWindowRect is for. You give it a client area size and a window style and it tells you what window rect to use to get that client area.   ;  Bingo! Thanks jwezorek. I see what its hiding now. Instead of making the calculations for your window to get the client area correct, you simply define your client area and then the function adjusts the structure accordingly to encompass the desired client area. Very nice.   