06-02-2008, 01:15 PM
Set timer that manages the toolbar. The best place for it is toolbar hook function.
This macro creates toolbar. For testing I used Notepad instead of Display. It also runs every time when the window becomes active, and calls TB_AltAttach, although it is not necessary but just makes faster.
Macro
Trigger !a"Notepad" "Notepad"
Toolbar hook function. It sets timer that calls TB_AltAttach every 1 s.
Function tb_hook_alt_attach
Function TB_AltAttach
First line of the toolbar.
Toolbar
This macro creates toolbar. For testing I used Notepad instead of Display. It also runs every time when the window becomes active, and calls TB_AltAttach, although it is not necessary but just makes faster.
Macro
Trigger !a"Notepad" "Notepad"

int hwnd=val(_command)
int htb=win("TOOLBAR34" "QM_toolbar")
if !htb
,htb=mac("Toolbar34" win("Program Manager" "Progman")) ;;create toolbar attached to desktop
,SetProp htb "ho" hwnd
TB_AltAttach htb hwnd
Toolbar hook function. It sets timer that calls TB_AltAttach every 1 s.
Function tb_hook_alt_attach
;/
function# hWnd message wParam lParam
sel message
,case WM_INITDIALOG
,SetTimer hWnd 3 1000 0
,
,case WM_TIMER
,TB_AltAttach hWnd GetProp(hWnd "ho")
Function TB_AltAttach
;/
function htb ho
if(!IsWindow(ho))
,clo htb
else if(IsWindowVisible(ho) and !IsIconic(ho))
,Zorder htb GetWindow(ho GW_HWNDPREV) SWP_NOACTIVATE
,Transparent htb 256
else
,Transparent htb 0
;note: uses Transparent instead of hid because QM would unhide
First line of the toolbar.
Toolbar