LoadIcon

Syntax

HICON LoadIcon(hInstance,lpIconName)

This function loads the icon resource named by the lpIconName parameter from the executable file associated with the module specified by the hInstance parameter. The function loads the icon only if it has not been previously loaded. Otherwise, it retrieves a handle to the loaded resource.

Parameter Type/Description  

hInstance HANDLE Identifies an instance of the module whose executable file contains the icon.  
lpIconName LPSTR Points to a character string that names the icon resource. The string must be a null-terminated character string.  

Return Value

The return value identifies an icon resource if the function is successful. Otherwise, it is NULL.

Comments

Use the LoadIcon function to access the predefined icons used by Windows. To do this, the hInstance parameter must be set to NULL, and the lpIconName parameter must be 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 lpIconName parameter can also contain a value created by the MAKEINTRESOURCE macro. If it does, the ID must reside in the low-order word of lpIconName, and the high-order word must be set to zero.