Menu and toolbar icons

Use the Icons dialog to find or create icons and assign them to menu items and toolbar buttons.

 

You can specify icon file after *. Also can be specified 0-based icon index. If icon is not specified, is used default icon. Use ** to prevent adding an icon. To prevent adding icons to all menu items, check 'No Icons' in Properties.

 

Examples:

Macro5 :mac "Macro5" * Shell32.dll * 5
Macro5 :mac "Macro5" * Shell32.dll,5
Select All :key Ca * C:\Icons\Select All.ico
:int i=2*2; paste(i * 10) * iconinmyqmfolder.ico
Macro5 :mac "Macro5" * $desktop$\ic1.ico
Macro5 :mac "Macro5" * "resource:<Macro5>ic1.ico"
Macro5 :mac "Macro5" **

 

 

QM 2.3.0. Icon index also can be specified using syntax iconfile,iconindex (example 2).

 

QM 2.4.1. Supports macro resources. If resource or file (full path) is enclosed in ", displays the icon in the code editor.

 

With menus created at run time (DynamicMenu), instead of icon file can be used icon handle. To retrieve icon handle, use GetFileIcon or GetWindowIcon or Windows API functions. Example. Icon handles can be used with toolbars too. The icons must not be destroyed until the toolbar is closed.

 Shows dynamically created menu of windows.

ARRAY(int) aw; GetMainWindows aw
ARRAY(__Hicon) ai.create(aw.len)
str s t
int i
for i 0 aw.len
	ai[i]=GetWindowIcon(aw[i])
	t.getwintext(aw[i])
	t.findreplace(" :" " [91]58]") ;;escape :
	t.escape(1) ;;escape " etc
	s+F"{t} :act {aw[i]}; err * {ai[i]}[]"
 out s
i=DynamicMenu(s "" 1)
if(i) outw aw[i-1]