Thread: AdjustWindowRect

  1. #1
    i dont know Vicious's Avatar
    Join Date
    May 2002


    I want the client area to be 320 x 240.
    Not the whole window.

    Now, here is my code.

    HWND WinClass::Create ( HINSTANCE hInstance, LPSTR class_name, LPSTR wnd_name, HWND parent,
    					    DWORD dwStyle, int x, int y, int width, int height )
    	RECT rect = { 0, 0, width, height };
    	AdjustWindowRect ( &rect, dwStyle, true );
    	hWnd = CreateWindow ( class_name, wnd_name, dwStyle, x, y, width, height,
    						  parent, NULL, hInstance, NULL );
    	return hWnd;
    Isnt this the correct way to makesure your "client" area is the desired resolution?
    What is C++?

  2. #2
    Registered User
    Join Date
    Sep 2004
    You can always use the WM_NCCALCSIZE to change the client rect size.

  3. #3
    train spotter
    Join Date
    Aug 2001
    near a computer
    You get the rect needed but don't use it.

    >>CreateWindow ( class_name, wnd_name, dwStyle, x, y, width, height,

    should be

    CreateWindow ( class_name, wnd_name, dwStyle, rect.left,,rect.right-rect.left,,

    (as the top and left may not be zero)

    AdjustWindowRect(&rect, GetWindowLong(hWnd,GWL_STYLE), TRUE);
    Last edited by novacain; 09-29-2004 at 03:09 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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. AdjustWindowRect/Setting client size
    By JaWiB in forum Windows Programming
    Replies: 4
    Last Post: 06-23-2006, 11:43 PM
  2. Simple AdjustWindowRect() problem
    By cdave in forum Windows Programming
    Replies: 2
    Last Post: 11-26-2005, 07:30 AM