CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2014
    Posts
    21

    How compute windows size with and without border?

    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);.

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,607

    Re: How compute windows size with and without border?

    Quote Originally Posted by Borneq View Post
    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);.
    This is not what you want in cySizeFrame, right?
    Best regards,
    Igor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured