News:

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

TrackPopupMenu

Started by Faiseur, December 30, 2004, 05:18:02 PM

Previous topic - Next topic

Faiseur

Excuse my bad English (translate)

I do not know if it is the good topic, i want only to announce a bug under Windows 2000 sp4 (Windows XP ok) by using example "RCLKMENU" of the pack Masm32.  By using the right button of the mouse the program "RCLKMENU" stops (error) when the menu appears.  That relates to the function "TrackPopupMenu", here: 


   .ELSEIF uMsg==WM_CONTEXTMENU   ;has user right clicked mouse?
      mov eax, lParam             ;if so, show the popup menu
      and eax, 0ffffh
      mov ebx, lParam
      shr ebx, 16
      invoke TrackPopupMenu, mnuhWnd, TPM_LEFTALIGN, eax, ebx, 0, hWnd, 0


I did not understand well, but by replacing "ebx" by "ecx" that functions without bug. 


   .ELSEIF uMsg==WM_CONTEXTMENU   ;has user right clicked mouse?
      mov eax, lParam             ;if so, show the popup menu
      and eax, 0ffffh
      mov ecx, lParam
      shr ecx, 16
      invoke TrackPopupMenu, mnuhWnd, TPM_LEFTALIGN, eax, ecx, 0, hWnd, 0



thank you for your good work
French asm Forum: http://www.asmforum.net/   Website: http://www.faiseur.net/

Relvinian

hehe, this probably should be under the MASM forum since it relates to one of the examples in the MASM32 package.

But you are correct, the example is using the EBX register without preserving it first.

Relvinian

PS - For those maintaining the examples, the file is:
\masm32\examples\examples8\rclkmenu.asm