Posts: 69
Threads: 42
Joined: Jun 2006
I have toolbar1 that popups when I press a key combination. This toolbar has a specific shape and position.
I want toolbar2 that, instead of appearing through a key combination, should be attached to a specific window.
The problem is that, although the two toolbars have different shapes, positions, triggers, I want them to have the same list of items, same buttons, so that, if I change, add or delete an item on toolbar1, it should be automatically changed, added or deleted on toolbar2.
How can I obtain this?
Posts: 1,338
Threads: 61
Joined: Jul 2006
sorry for the late reply didn't see your post. This can be done. Probably the easiest way is to use a hook on Toolbar2.So when toolbar2 starts or is running checks toolbar1 for changes and changes toolbar2.
for example
Toolbar Toolbar1
Trigger Cg
;/mov 936 79 /siz 45 256 /isiz 32 32
notepad :run "$system$\notepad.exe"
Snipping Tool :run "$system$\SnippingTool.exe"
Windows Media Player :run "$program files$\Windows Media Player\wmplayer.exe" "/prefetch:1" "" "$program files$\Windows Media Player"
Toolbar Toolbar2
Trigger !v"" "CabinetWClass"
;/mov 367 3 /siz 209 43 /isiz 32 32 /hook WndProc_Toolbar2Hook
and
Function WndProc_Toolbar2Hook
;/
function# hwnd message wParam lParam
;<help #IDH_EXTOOLBAR>Toolbar hook help</help>
;OutWinMsg message wParam lParam ;;uncomment to see received messages
sel message
,case WM_INITDIALOG
,str tb1.getmacro("Toolbar1" 0)
,str tb2.getmacro("Toolbar2" 0)
,str tb2t tb1t tb2tf tb1tf
,foreach tb1t tb1
,,if tb1t.beg(" /")=0
,,,tb2t.addline(tb1t 1)
,_s.getl(tb2 0)
,tb2t- F"{_s}[]"
,tb2t.setmacro("Toolbar2")
,SetTimer hwnd 1 30000 0;; timer 30 seconds
,case WM_TIMER
,sel wParam
,,case 1
,,tb1.getmacro("Toolbar1" 0)
,,tb2.getmacro("Toolbar2" 0)
,,foreach tb1t tb1
,,,if tb1t.beg(" /")=0
,,,,tb1tf.addline(tb1t 1)
,,foreach tb2t tb2
,,,if tb2t.beg(" /")=0
,,,,tb2tf.addline(tb2t 1)
,,if tb1tf<>tb2tf
,,,_s.getl(tb2 0)
,,,tb2tf=tb1tf
,,,tb2tf- F"{_s}[]"
,,,tb2tf.setmacro("Toolbar2")
,case WM_DESTROY
,KillTimer hwnd 1
Posts: 69
Threads: 42
Joined: Jun 2006
Wow, that’s amazing! It works! Thank you very much.
|