CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2005
    Location
    Nürnberg, Bavaria, Germany
    Posts
    6

    GetMenuBarInfo: no result

    Hi,

    need to know the size of my menubar, but got a problem with GetMenuBarInfo:
    after the function call MENUBARINFO.rcBar is not initialized, and the returncode = false.
    The errorcode returnde by GetLastError = 0.

    I think I'm using a wrong argument, but which one?

    HWND hWnd = <handle of the TopWindow that owns the menuBar>
    LONG lObject = OBJID_MENU
    LONG lItem = 0
    MENUBAR.cbSize = sizeof(MENUBAR)

    What could be wrong? Do I have to use the windowhandle of the menuBar instead of the TopLevelWindow? And if so, how to get it?

    Thanks in advance
    Best regards
    testalucida

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: GetMenuBarInfo: no result

    What is MENUBAR?
    Show your actual code.
    Victor Nijegorodov

  3. #3
    Join Date
    Jan 2005
    Location
    Nürnberg, Bavaria, Germany
    Posts
    6

    Re: GetMenuBarInfo: no result

    sorry, should be: MENUBARINFO

    static RECT & GetMenuBarSize( HWND owner, RECT & rect ) {
    MENUBARINFO mbi;
    mbi.cbSize = sizeof( MENUBARINFO );
    bool bOk = GetMenuBarInfo( owner, OBJID_MENU, (LONG)0, &mbi ); //returns false

    DWORD err = GetLastError(); // returns 0
    rect = mbi.rcBar;
    return rect;
    }

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: GetMenuBarInfo: no result

    Hm... A little strange function...
    And how are you using it? And what is the value of HWND owner? How do you obtain it?
    Victor Nijegorodov

  5. #5
    Join Date
    Jun 2008
    Posts
    37

    Re: GetMenuBarInfo: no result

    True, I tink getMenuBaMInfo has a null owner. set a brak point and see the value clear.

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