%U_ICON

Set an icon or get an icon count

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows

 

 

status = %U_ICON(D_ICONSET, filename, index[, window_id])
status = %U_ICON(D_ICONCOUNT, filename, count)

or

xcall U_ICON(D_ICONSET, filename, index[, window_id])
xcall U_ICON(D_ICONCOUNT, filename, count)

Return value

status

On Windows, true (1) if the icon file exists and contains icons, or false (0) if the icon file does not exist or contains no icons. On UNIX and OpenVMS, always returns false. (^VAL)

Arguments

D_ICONSET

Set an icon. (n)

filename

The name of the file that contains the icon to set or the icons to count. (a)

index

The icon index for D_ICONSET (l‑based). (n)

window_id

(optional) The ID of the window. (n)

D_ICONCOUNT

Get the count of icons in the file. (n)

count

The icon count returned from D_ICONCOUNT. (n)

Discussion

%U_ICON sets an icon for a window or gets a count of icons in a file.

Filename can be an .ico file, a DLL, an executable program (.exe), or a bitmap image (.bmp). You can use environment variables in filename.

In Synergy .NET, this routine works only for the container window, and it uses only the first icon in the icon file. It ignores the index and count arguments (though you still must pass them) and the window_id argument.

Setting an icon for a window

To set an icon for a window, pass D_ICONSET and the index (1‑based) for the icon (i.e., pass the icon’s position in the file). An index value of 0 will set the icon to the default Windows system icon. For an .ico file, you must pass 1 as index.

Window_id determines which window the icon will be applied to:

Getting a count of icons in a file

To get a count of icons in a file, pass D_ICONCOUNT and a variable as count to accept the returned count.

See also

%L_ICON routine for setting a list icon

Examples

The following example sets the application icon to the third icon in a file named iconfil.dll. If the icon cannot be found, an error is displayed.

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