# Function Reference

# _WinAPI_LoadIcon

Loads the specified icon resource from the executable (.exe) file associated with an application instance

#include <WinAPIIcons.au3>
_WinAPI_LoadIcon ( $hInstance, $sName )

## Parameters

$hInstance | A handle to an instance of the module whose executable file contains the icon to be loaded.
$sName | The name of the icon resource to be loaded. Alternatively, if $hInstance is 0, it can be one of the following predefined values. $IDI_APPLICATION $IDI_HAND $IDI_QUESTION $IDI_EXCLAMATION $IDI_ASTERISK $IDI_WINLOGO $IDI_SHIELD $IDI_ERROR $IDI_INFORMATION $IDI_WARNING

## Return Value

Success: | The icon handle.
Failure: | 0, call _WinAPI_GetLastError() to get extended error information.

## Remarks

_WinAPI_LoadIcon() loads the icon resource only if it has not been loaded; otherwise, it retrieves a
handle to the existing resource.
_WinAPI_LoadIcon() can only load an icon whose size conforms to the $SM_CXICON and $SM_CYICON system metric
values. Use the _WinAPI_LoadImage() function to load icons of other sizes.
When you are finished using the icon, destroy it using the _WinAPI_DestroyIcon() function.

## Related

_WinAPI_DestroyIcon, _WinAPI_LoadImage

## See Also

Search LoadIcon in MSDN Library.