Author Topic: GetMenuBarInfo  (Read 3760 times)

jj2007

  • Member
  • *****
  • Posts: 9928
  • Assembler is fun ;-)
    • MasmBasic
GetMenuBarInfo
« on: May 08, 2014, 12:56:37 AM »
Hi everybody,

Does qWord's GetMenuBarInfo 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.

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Re: GetMenuBarInfo
« Reply #1 on: May 08, 2014, 01:15:45 AM »
Jochen,

could you attach the right source for jWasm?

Gunther
Get your facts first, and then you can distort them.

qWord

  • Member
  • *****
  • Posts: 1473
  • The base type of a type is the type itself
    • SmplMath macros
Re: GetMenuBarInfo
« Reply #2 on: May 08, 2014, 01:18:06 AM »
The structure declaration in windows.inc is wrong.
MREAL macros - when you need floating point arithmetic while assembling!

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Re: GetMenuBarInfo
« Reply #3 on: May 08, 2014, 01:34:27 AM »
Hi qWord,

The structure declaration in windows.inc is wrong.

thank you for the information. What's wrong?

Gunther
Get your facts first, and then you can distort them.

qWord

  • Member
  • *****
  • Posts: 1473
  • The base type of a type is the type itself
    • SmplMath macros
Re: GetMenuBarInfo
« Reply #4 on: May 08, 2014, 01:42:59 AM »
The last two members (with "f" prefix) are bit fields:
Code: [Select]
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.
MREAL macros - when you need floating point arithmetic while assembling!

jj2007

  • Member
  • *****
  • Posts: 9928
  • Assembler is fun ;-)
    • MasmBasic
Re: GetMenuBarInfo
« Reply #5 on: May 08, 2014, 04:11:13 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