.ELSEIF uMsg==WM_INITMENU
invoke GetCursorPos,addr pt
invoke ScreenToClient,hWnd,addr pt
.IF pt.x>154
mov eax, lParam
invoke PostMessage,hWnd,WM_NCLBUTTONDOWN,HTCAPTION,0
.ENDIF
Ok, I looked what you did. But what did you?
He made the window draggable over the menu by fooling windows into thinking the user clicked the title bar. So that the menu is still useable, it only works if the mouse's horizontal position is > 154. .
Works well until you set the system menu font to something wider. :grin:
Works well until you set the system menu font to something wider. :grin:
True.
You would have to calculate the menu size somehow. I think I've seen this done before but I can't remember where.
Also you will have to do it s.th. like this:
if your using a tray icon with popup menu.
You would have to calculate the menu size somehow. I think I've seen this done before but I can't remember where.
Also you will have to do it s.th. like this:
.ELSEIF uMsg==WM_INITMENU
invoke GetCursorPos,addr pt
invoke ScreenToClient,hWnd,addr pt
mov eax,pt.y
test eax,eax
.IF (SIGN?)
.IF pt.x>154
invoke PostMessage,hWnd,WM_NCLBUTTONDOWN,HTCAPTION,0
.ENDIF
.ENDIF
if your using a tray icon with popup menu.
I'm just taking a stab in the dark here, but this might be how you calculate the width of the collective menu items.
I haven't tested it, but you get the general idea. Let me know how it works.
[size=12]GetMenuBtnsWidth proc hwnd:DWORD
LOCAL TempRect :RECT
LOCAL hmenu :DWORD
LOCAL RetVal :DWORD
xor eax, eax
mov RetVal, eax
; Get handle to window's menu...
invoke GetMenu,hwnd
or eax, eax
jz @Error
mov hmenu, eax
; Get # of items in menu...
invoke GetMenuItemCount,hmenu
cmp eax, -1
jz @Error
; Loop through adding up all the widths
; of the menu items...
lea ecx, [eax - 1]
@: push ecx
invoke GetMenuItemRect, hwnd, hmenu, ecx, ADDR TempRect
pop ecx
or eax, eax
jz @Error
mov eax, TempRect.right
sub eax, TempRect.left
add RetVal, eax
loop @b
mov eax, RetVal
ret
@Error: mov eax, -1
ret
GetMenuBtnsWidth endp[/size]
I haven't tested it, but you get the general idea. Let me know how it works.
Sorry,
didn't check back before today.
Works great and I'm using it though I got fixed menus anyway :grin:
One thing though:
needs to be:
or the very first menu item won't get checked on ;)
didn't check back before today.
Works great and I'm using it though I got fixed menus anyway :grin:
One thing though:
loop @b
needs to be:
dec ecx
jns @b
or the very first menu item won't get checked on ;)