code_junkie

window border width and height in Win32 - how do I get it?

Nov 13th, 2011
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  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. }
  11.  
  12. void ClientResize(HWND hWnd, int nWidth, int nHeight)
  13. {
  14. RECT rcClient, rcWind;
  15. POINT ptDiff;
  16. GetClientRect(hWnd, &rcClient);
  17. GetWindowRect(hWnd, &rcWind);
  18. ptDiff.x = (rcWind.right - rcWind.left) - rcClient.right;
  19. ptDiff.y = (rcWind.bottom - rcWind.top) - rcClient.bottom;
  20. MoveWindow(hWnd,rcWind.left, rcWind.top, nWidth + ptDiff.x, nHeight + ptDiff.y, TRUE);
  21. }
  22.  
  23. void ClientResize(HWND hWnd, int nWidth, int nHeight)
  24. {
  25. RECT rcClient, rcWind;
  26. POINT ptDiff;
  27. GetClientRect(hWnd, &rcClient);
  28. GetWindowRect(hWnd, &rcWind);
  29. ptDiff.x = (rcWind.right - rcWind.left) - rcClient.right;
  30. ptDiff.y = (rcWind.bottom - rcWind.top) - rcClient.bottom;
  31. MoveWindow(hWnd,rcWind.left, rcWind.top, nWidth + ptDiff.x, nHeight + ptDiff.y, TRUE);
  32. }
  33.  
  34. int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
  35.  
  36. GetClientRect(hWnd, &rcClient);
  37. GetWindowRect(hWnd, &rcWind);
  38. int border_thickness = ((rcWind.right - rcWind.left) - rcClient.right)/2;
Add Comment
Please, Sign In to add comment