Quantcast
Channel: CodeGuru Forums - C++ and WinAPI
Viewing all articles
Browse latest Browse all 583

How compute windows size with and without border?

$
0
0
I am working under Windows 8.1; I test window size with border and without border. Horizontal difference is 16, vertical 39. 39 = cyCaption+16;
Frame has 8 on all sides? Why cySizeFrame = 4 and cyBorder is only 1 ?
Code:

 
  SetWindowPos(hWnd,  HWND_TOP,  100,  100,  300,  70,  SWP_SHOWWINDOW);
  RECT rcClient, rcWind;
  GetClientRect(hWnd, &rcClient);
  GetWindowRect(hWnd, &rcWind);
  int xdiff =  (rcWind.right-rcWind.left)-(rcClient.right-rcClient.left);//16
  int ydiff =  (rcWind.bottom-rcWind.top)-(rcClient.bottom-rcClient.top);//39
  int cxSizeFrame = GetSystemMetrics(SM_CXSIZEFRAME);
  int cySizeFrame = GetSystemMetrics(SM_CXSIZEFRAME);
  int cyCaption = GetSystemMetrics(SM_CYCAPTION);
  int cyBorder = GetSystemMetrics(SM_CYBORDER);.


Viewing all articles
Browse latest Browse all 583

Trending Articles