Client Area Size with MoveWindow


/ Published in: C++
Save to your folder(s)

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


Copy this code and paste it in your HTML
  1. void ClientResize(HWND hWnd, int nWidth, int nHeight)
  2. {
  3. RECT rcClient, rcWind;
  4. POINT ptDiff;
  5. GetClientRect(hWnd, &rcClient);
  6. GetWindowRect(hWnd, &rcWind);
  7. ptDiff.x = (rcWind.right - rcWind.left) - rcClient.right;
  8. ptDiff.y = (rcWind.bottom - rcWind.top) - rcClient.bottom;
  9. MoveWindow(hWnd,rcWind.left, rcWind.top, nWidth + ptDiff.x, nHeight + ptDiff.y, TRUE);
  10. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.