Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tray icon help
#1
Ok i can create the tray icon fine

Function Function6
Code:
Copy      Help
AddTrayIcon "mouse.ico" "Dialog1" "DLG1"
wait -1

But when I close the dialog, i want it to delete the tray icon as well
And i got this from the help files in QM on deleting tray icons but it doesnt work

Function Function3
Trigger !d"Dialog1"     Help - how to add the trigger to the macro
Code:
Copy      Help
int hwnd=val(_command)
if(m_flags&1)
,m_flags~1
,Shell_NotifyIconW(NIM_DELETE &nd)
,int i hi
,m_a.redim
__m_func=0
m_hwnd=0
#2
Read AddTrayIcon help.
Quote:It is automatically deleted when macro ends.
To delete before that, use "<delete>" as iconfile.

Macro
Code:
Copy      Help
AddTrayIcon "mouse.ico" "Dialog1" "DLG1"
wait 3
AddTrayIcon "<delete>"
out "icon deleted"
wait 3
out "macro ended"

Both AddTrayIcon calls must be from the same thread. To delete from other thread, somehow notify the thread that added the icon to delete the icon.

Or use variable of Tray type.
Macro
Code:
Copy      Help
Tray t.AddIcon("mouse.ico" "Dialog1" 0 0 0 "DLG1")
wait 3
t.Delete
out "icon deleted"
wait 3
out "macro ended"


Forum Jump:


Users browsing this thread: 1 Guest(s)