The MASM Forum

General => The Workshop => Topic started by: jj2007 on May 08, 2014, 12:56:37 AM

Title: GetMenuBarInfo
Post by: jj2007 on May 08, 2014, 12:56:37 AM
Hi everybody,

Does qWord's GetMenuBarInfo (http://www.masmforum.com/board/index.php?topic=16156.msg133580#msg133580) example still work? I am on Win7-32 now, and it fails consistently with invalid parameter...

Note some assemblers complain about redefinition. Just put an if 0 ... endif around the MENUBARINFO definition on top.
Title: Re: GetMenuBarInfo
Post by: Gunther on May 08, 2014, 01:15:45 AM
Jochen,

could you attach the right source for jWasm?

Gunther
Title: Re: GetMenuBarInfo
Post by: qWord on May 08, 2014, 01:18:06 AM
The structure declaration in windows.inc is wrong.
Title: Re: GetMenuBarInfo
Post by: Gunther on May 08, 2014, 01:34:27 AM
Hi qWord,

Quote from: qWord on May 08, 2014, 01:18:06 AM
The structure declaration in windows.inc is wrong.

thank you for the information. What's wrong?

Gunther
Title: Re: GetMenuBarInfo
Post by: qWord on May 08, 2014, 01:42:59 AM
The last two members (with "f" prefix) are bit fields:
typedef struct tagMENUBARINFO
{
    DWORD cbSize;
    RECT rcBar;          // rect of bar, popup, item
    HMENU hMenu;         // real menu handle of bar, popup
    HWND hwndMenu;       // hwnd of item submenu if one
    BOOL fBarFocused:1;  // bar, popup has the focus
    BOOL fFocused:1;     // item has the focus
} MENUBARINFO, *PMENUBARINFO, *LPMENUBARINFO;

The structure in windows.inc use two BOOLs instead of one SDWORD (BOOL).
Interestingly the  declaration that can be found on MSDN is also wrong.
Title: Re: GetMenuBarInfo
Post by: jj2007 on May 08, 2014, 04:11:13 AM
Quote from: qWord on May 08, 2014, 01:42:59 AM
The structure in windows.inc use two BOOLs instead of one SDWORD (BOOL).

In clear violation of assembly rule #1: everything is a DWORD ;-)

Thanks, it works :t