.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
Posted on 2002-08-11 16:34:02 by goofee
Ok, I looked what you did. But what did you?
Posted on 2002-08-12 07:08:02 by Marwin
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:
Posted on 2002-08-12 07:33:44 by iblis
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:


.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.
Posted on 2002-08-12 07:57:29 by goofee
I'm just taking a stab in the dark here, but this might be how you calculate the width of the collective menu items.


[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.
Posted on 2002-08-12 09:46:24 by iblis
Sorry,
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 ;)
Posted on 2002-08-17 07:24:40 by goofee