HICON LoadIcon(hinst, lpszIcon) | |||||
HANDLE hinst; | /* handle of application instance | */ | |||
LPCTSTR lpszIcon; | /* icon-name string or icon resource identifier | */ |
The LoadIcon function loads the specified icon resource from the executable file associated with the given application instance.
hinst
Identifies an instance of the module whose executable file contains the icon to be loaded. This parameter must be NULL when a system icon is being loaded.
lpszIcon
Points to a null-terminated string that contains the name of the icon resource to be loaded. Alternatively, this parameter can consist of the resource identifier in the low-order word and zero in the high-order word. The MAKEINTRESOURCE macro can be used to create this value.
The return value is the handle of the newly loaded icon if the function is successful. Otherwise, it is NULL.
This function loads the icon resource only if it has not been loaded; otherwise, it retrieves a handle of the existing resource.
An application can use the LoadIcon function to access the predefined icons used by Windows. To do this, the application must set the hinst parameter to NULL and the pszIcon parameter to one of the following values:
Value | Meaning |
IDI_APPLICATION | Default application icon. |
IDI_ASTERISK | Asterisk (used in informative messages). |
IDI_EXCLAMATION | Exclamation point (used in warning messages). |
IDI_HAND | Hand-shaped icon (used in serious warning messages). |
IDI_QUESTION | Question mark (used in prompting messages). |
The LoadIcon function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set.
CreateIcon