LoadIcon
LoadIcon is a Windows API function that loads an icon resource from a module’s resources, typically within an executable or DLL. It provides a simple way to obtain an HICON handle to an icon defined in the application’s resources or to a system-provided icon. The function is part of the User32 library and is considered a legacy, for straightforward icon loading; for more control, newer code often uses LoadImage.
- HICON LoadIcon(HINSTANCE hInstance, LPCTSTR lpIconName)
- hInstance: A handle to the module whose resources contain the icon. This is usually the hInstance
- lpIconName: A pointer to a null-terminated string naming the icon resource, or a value created with
- On success, returns a handle to the requested icon (HICON). If the function fails, returns NULL.
- The lpIconName can reference a resource ID (MAKEINTRESOURCE) or a resource name defined in the module’s
- Icons loaded with LoadIcon should be destroyed with DestroyIcon when no longer needed, unless the icon
- LoadIcon loads only icon resources embedded in the module. To load icons from files or to
- IDI_APPLICATION and other system icon IDs
---