ExtractAssociatedIcon function
Retrieves a handle to an indexed icon found in a file or an icon found in an associated executable file.
Syntax
HICON WINAPI ExtractAssociatedIcon( _Reserved_ HINSTANCE hInst, _Inout_ LPTSTR lpIconPath, _Inout_ WORD *lpiIcon );
Parameters
- hInst
-
Type: HINSTANCE
A handle to the instance of the application calling the function.
- lpIconPath [in, out]
-
Type: LPTSTR
The full path and file name of the file that contains the icon. The function extracts the icon handle from that file, or from an executable file associated with that file. If the icon handle is obtained from an executable file, the function stores the full path and file name of that executable in the string pointed to by lpIconPath.
- lpiIcon [in, out]
-
Type: WORD*
The index of the icon whose handle is to be obtained. If the icon handle is obtained from an executable file, the function stores the icon's identifier in this parameter.
Return value
Type: HICON
If the function succeeds, the return value is an icon handle. If the icon is extracted from an associated executable file, the function stores the full path and file name of the executable file in the string pointed to by lpIconPath, and stores the icon's identifier in the variable pointed to by lpiIcon.
If the function fails, the return value is NULL.
Remarks
You must destroy the icon handle returned by ExtractAssociatedIcon by calling the DestroyIcon function.
The ExtractAssociatedIcon function first looks for the indexed icon in the file specified by lpIconPath. If the function cannot obtain the icon handle from that file, and the file has an associated executable file, it looks in that executable file for an icon. Associations with executable files are based on file name extensions, are stored in the per-user part of the registry, and can be defined using File Manager's Associate command.
Requirements
|
Minimum supported client |
Windows 2000 Professional [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names |
ExtractAssociatedIconW (Unicode) and ExtractAssociatedIconA (ANSI) |
See also
- Reference
- ExtractIcon
- Conceptual
- Icons