CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2002
    Location
    Chicago, IL
    Posts
    255

    WM_GETTITLEBARINFOEX has wrong button rects

    Hi everyone -

    I'm trying to make use of the WM_GETTITLEBARINFOEX message on a Windows 7 machine. It seems however that the sizes for the Minimize, Maximize, and Close buttons are incorrect until the user resizes the window. See the attached bitmap. I'm outlining the rect for each button (in green) and the rect for the titlebar (in red). The first image shows the data I get after the window is launched. The second image shows the data I get after I resize the window just slightly. It seems like the rects for the system buttons are correctly determined only after a resize. Does this make sense to anyone? Is there a way I can force the correct values to be determined without a resize?
    Attached Images Attached Images  

  2. #2
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,656

    Re: WM_GETTITLEBARINFOEX has wrong button rects

    When exactly do you "make use of the WM_GETTITLEBARINFOEX message"?
    Maybe the visual styles were not applied yet?
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinWindows - replacement windows manager for Visual Studio, and more...

  3. #3
    Join Date
    Mar 2002
    Location
    Chicago, IL
    Posts
    255

    Re: WM_GETTITLEBARINFOEX has wrong button rects

    In this particular case, I'm in the OnCreate(LPCREATESTRUCT) handler for my frame class, after calling the base class. It's possible that the visual styles haven't yet been applied, but I'm not sure when they happen. I did a quick 'hack' where I post a message to myself in the OnCreate handler and when I handle that message, send the WM_GETTITLEBARINFOEX message again, and at that point the data seems correct. So maybe I'm just calling it too early in the creation of the frame.

  4. #4
    Join Date
    Mar 2002
    Location
    Chicago, IL
    Posts
    255

    Re: WM_GETTITLEBARINFOEX has wrong button rects

    Another thing - when I run in Windows Classic mode on Windows 7, the rectangles WM_GETTITLEBARINFOEX returns are incorrect for the buttons. I can't seem to find a reliable way to get the rectangles for these system buttons regardless of the OS or theme.
    Attached Images Attached Images  

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