0
votes

I have some hotkeys in a script with a custom tray icon.

Menu Tray, Icon, my_hotkeys.ico

One of them shows a message box with an OK button and question mark icon.

MsgBox, 32, My Hotkeys, Hey, here's some info...

But, it has the default green H AutoHotkey image in the Windows taskbar. I've looked through all the Menu options. And the GUI command claims that it uses the Menu icon, if set. But I can't find anything specific to MsgBox. Is there any way to change the MsgBox icon to the same custom icon that I'm using in the system tray?

1
you want to set an icon to tray and use the same one for the msgbox?Joe DF

1 Answers

4
votes

There are several possible solutions:

  • Create and show a Gui with +OwnDialogs before calling MsgBox.
  • Code your own MsgBox look-alike using the Gui commands.
  • Compile your script (convert to exe) with a custom icon.
  • Replace the icon resources in AutoHotkey.exe (affecting all scripts).
  • Set a timer before showing the MsgBox, then send WM_SETICON after it appears.
  • Hook creation of the MsgBox window to set the icon before the window is shown - example in C++.

+OwnDialogs example:

Menu Tray, Icon, shell32.dll, 5  ; Folder icon
Gui +OwnDialogs
Gui Show           ; Since it has zero dimensions, it should be invisible.
MsgBox Testing...
ExitApp