CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002
    Location
    Candia, NH
    Posts
    374

    Window size and documentation conflict

    The three functions
    CreateWindow()
    GetClientRect()
    GetWindowRect()

    are somehwat in conflict with my documentation.

    In CreateWindow() I specify the window position and size with

    0,0,100,100.

    Then I call
    GetClientRect() and GetWindowRect(). I want to get the size of the window frames.

    Heres what I get:
    clientrect.left = 0
    clientrect.top = 0
    clientrect.right = 111
    clientrect.bottom = 42

    windowrect.left = 0
    windowrect.top = 0
    windowrect.right = 123
    windowrect.bottom = 100

    It seems that the CreateWindow() function 'width' value gives the width of the client area, not the window, whereas the 'height' value gives the height of the window and not the client.

    Is this a known feature? That's not what my documentation says!

  2. #2
    I assume that Windows inherently sets a minimum width and minimum height of the window, so that the user doesn't resize it so much that it becomes hard to find.

  3. #3
    Join Date
    Dec 2002
    Location
    Candia, NH
    Posts
    374
    You are right. That was exactly the problem. Setting the width to 100 was below some internal minimum and Windows changed it to something else. When I set the width ro 200, that was no longer the case. So all I did was to let widnows decide the window size and take the difference between the client and window rectangles.

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