News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

MenuItemFromPoint - too few arguments

Started by georgek01, October 04, 2005, 11:40:52 AM

Previous topic - Next topic

georgek01

Hi there,

When using MenuItemFromPoint the compiler complains about too few arguments. According to MSDN, the function expects 3 parameters only.

USER32.INC defines the procedure with 4 parameters. What should the 4th parameter be? Can I just add NULL as the 4th parameter?

Invoke:
invoke MenuItemFromPoint,hWin,addr hPopup,addr pt

Error:
error A2137: too few arguments to INVOKE


Regards,
George
What we have to learn to do, we learn by doing.

- ARISTOTLE (384-322 BC)

Tedd

Two things:
- it does only take 3 (dword) arguments -- looks like you found an error in user32.inc ::)
- change "addr hPopup" to just "hPopup" :bg



UINT WINAPI MenuItemFromPoint(
    HWND  hWnd,
    HMENU  hMenu,
    POINT  ptScreen
   );
No snowflake in an avalanche feels responsible.

georgek01

Thanks Tedd!

I changed the INC - still didn't work 'cause the LIB must be wrong too...

Error:
error LNK2001: unresolved external symbol _MenuItemFromPoint@12

Can I add NULL as the 4th parameter?
What we have to learn to do, we learn by doing.

- ARISTOTLE (384-322 BC)

akyprian

try pt.x as the 3rd parameter and pt.y as the fourth

Antonis

georgek01

These undocumented secrets should be documented.  :P

Thanks Antonis!
What we have to learn to do, we learn by doing.

- ARISTOTLE (384-322 BC)

Tedd

#5
a POINT structure contains both x and y. It's not a good idea to push extra parameters when they're not expected as they will stay on the stack until the call of another function - who will take them as its parameters! Which will cause an exception if you're lucky, or mess up the stack even more for the next function call, and so on until eventually you will get an excpetion.

You will have to rebuild user32.lib from user32.inc if you make any changes to the inc -- use inc2l.exe
No snowflake in an avalanche feels responsible.

akyprian

@Tedd: From MSDN, the 3rd parameter of MenuItemFromPoint (ptScreen) is
a POINT structure and NOT a pointer to a POINT structure. So, this is the correct way to do it.

Antonis

Tedd

Quote from: akyprian on October 05, 2005, 09:39:28 AM
@Tedd: From MSDN, the 3rd parameter of MenuItemFromPoint (ptScreen) is
a POINT structure and NOT a pointer to a POINT structure. So, this is the correct way to do it.

Sorry, my mistake. You are correct :U
Though it does seem a little out of fashion with the other api functions - but trust microsoft ::)
No snowflake in an avalanche feels responsible.