Set a list icon

WTSupported in traditional Synergy on Windows




status = %L_ICON(list_id, filename[, index])


xcall L_ICON(list_id, filename[, index])

Return value


On Windows, returns true if the icon was loaded, and false otherwise. On UNIX, always returns false. On OpenVMS, always returns true. (^VAL)



The ID of the list. (n)


The name of the icon file to use. (a)


(optional) The index within filename of the icon to load (1-based). (n)


%L_ICON sets an icon for a Toolkit list or ActiveX Toolkit list control.

The icon is used for the system menu, which is displayed if a close, move, size, minimize, or maximize method is associated with the window. See %U_WNDEVENTS for the circumstances under which a system menu is displayed. The L_METHOD subroutine must also be called to associate a %U_WNDEVENTS method set with the list.

You must either include tools.def or use the -X compiler option. Otherwise, a compilation error will occur.

If list_id is not the ID of an active list, an error is generated.

Filename can be an .ico file, a DLL, an executable program (.exe), or a bitmap image (.bmp). You can use environment variables in filename. If filename is invalid, no error is generated, however the return value will be false and the list’s icon will remain unmodified.

A file can contain multiple icons. Setting index specifies which icon to use. The default is 1, and a value of 0 sets the icon to the default Windows system icon. For an .ico file, index must be set to 1.

See also

%U_ICON routine for more information on setting a window icon


The following example sets the list icon to the third icon in the iconfil.dll file. If the icon could not be found, an error is displayed.

if (.not.(%l_icon(list, "iconfil.dll", 3)))
  xcall u_message("Could not set icon")