Return to Snippet

Revision: 61006
at November 22, 2012 06:10 by pijon


Initial Code
void ClientResize(HWND hWnd, int nWidth, int nHeight)
{
  RECT rcClient, rcWind;
  POINT ptDiff;
  GetClientRect(hWnd, &rcClient);
  GetWindowRect(hWnd, &rcWind);
  ptDiff.x = (rcWind.right - rcWind.left) - rcClient.right;
  ptDiff.y = (rcWind.bottom - rcWind.top) - rcClient.bottom;
  MoveWindow(hWnd,rcWind.left, rcWind.top, nWidth + ptDiff.x, nHeight + ptDiff.y, TRUE);
}

Initial URL
http://suite101.com/article/client-area-size-with-movewindow-a17846

Initial Description
Calculate the size of all the window borders + client area.

Initial Title
Client Area Size with MoveWindow

Initial Tags


Initial Language
C++