Hi all

I want to make a popup menu on a treeview control.
I use after WM_NOTIFY and NM_RCLICK event.

invoke CreatePopupMenu
mov handle_menu,eax
szText szstrExport,"Export"
invoke AppendMenu,handle_menu,MF_STRING,1,addr szstrExport
and i would like to use:

invoke TrackPopupMenu,handle_menu,TPM_LEFTALIGN or TPM_RETURNCMD or TPM_TOPALIGN ,mouse_X,mouse_Y,NULL,hWnd,NULL

My problem is to get mouse x,y on the treeview to draw popup menu at right location.

Anyone can help me please ?


Posted on 2003-03-10 06:01:57 by sv_reverser
You can probably use GetMessagePos:
The GetMessagePos function retrieves the cursor position for the last message retrieved by the GetMessage function.
DWORD GetMessagePos(VOID);

Return Value
The return value specifies the x- and y-coordinates of the cursor position. The x-coordinate is the low order int and the y-coordinate is the high-order int.

Posted on 2003-03-10 06:13:12 by Thomas
Hi Thomas :alright:

Thanks a lot !!!!!

It works and MSDN GetMessagePos Function refers to another one : BOOL GetCursorPos( LPPOINT lpPoint);
wich works well too :)


Posted on 2003-03-10 07:17:02 by sv_reverser
Yes but GetCursorPos gets the mouse position at the time this function is called while GetMessagePos will give the mouse position at the time of the right click (or any other message). So GetMessagePos is more accurate.

Posted on 2003-03-10 07:26:40 by Thomas