Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Toolbar on a popup menu
#1
I wonder whether it is possible to attach a toolbar on a popup menu generated with MenuPopup. If I would use a window visible trigger, how could I find the popup menu's specifications (window name, class).
#2
Macro Macro2760
Code:
Copy      Help
int hh=SetWindowsHookEx(WH_CBT &sub.HookCbtProc 0 GetCurrentThreadId)

int r=ShowMenu("one[]two[]three")

UnhookWindowsHookEx hh


#sub HookCbtProc
function# code wParam lParam
if code=HCBT_CREATEWND and GetClassLong(wParam GCW_ATOM)=32768
,mac "Toolbar on QM popup menu"

ret CallNextHookEx(0 code wParam +lParam)

Toolbar Toolbar on QM popup menu
Code:
Copy      Help
test :out "test"; clo TriggerWindow
#3
Many thanks, it is perfect!
#4
Dear Gintaras,

Let me ask one additional relevant question : Is there any way to find the pop-up window's location and dimensions (GetWinXY). I need the in order to position this toolbar accordingly.

Many thanks in advance.
#5
wParam is menu window handle.
#6
Thank you. I thought it was so. Therefore I have modified the hook function as it follows :

Macro Macro2760
Code:
Copy      Help
;www.quickmacros.com/forum/viewtopic.php?p=30301

int hh=SetWindowsHookEx(WH_CBT &sub.HookCbtProc 0 GetCurrentThreadId)

int r=ShowMenu("one[]two[]three")

UnhookWindowsHookEx hh


#sub HookCbtProc
function# code wParam lParam
if code=HCBT_CREATEWND and GetClassLong(wParam GCW_ATOM)=32768

,int x y cx cy
,GetWinXY wParam x y cx cy
,out F"{x} {y} {cx} {cy}"
,
,
,mac "Toolbar on QM popup menu"

ret CallNextHookEx(0 code wParam +lParam)

Nevertheless, I get 4 zeros.

Please, advise.
#7
The window is created with zero size, then resized. Need to call GetWinXY later, eg set timer...

There is another hook API.
Macro Macro2761
Code:
Copy      Help
int hh=SetWinEventHook(EVENT_OBJECT_SHOW EVENT_OBJECT_SHOW 0 &sub.Hook_SetWinEventHook GetCurrentProcessId GetCurrentThreadId WINEVENT_OUTOFCONTEXT)
int r=ShowMenu("one[]two[]three")
UnhookWinEvent hh


#sub Hook_SetWinEventHook
function hHook event hwnd idObject idChild dwEventThread dwmsEventTime

;outw hwnd
if hwnd and GetClassLong(hwnd GCW_ATOM)=32768
,int x y cx cy
,GetWinXY hwnd x y cx cy
,out F"{x} {y} {cx} {cy}"
,
,
,;mac "Toolbar on QM popup menu"
#8
Thank you so much. I tested it, it works perfectly!


Forum Jump:


Users browsing this thread: 1 Guest(s)