ExtractAssociatedIconEx function
[ExtractAssociatedIconEx is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.]
Gets a handle to an icon stored as a resource in a file or an icon stored in a file's associated executable file. It extends the ExtractAssociatedIcon function by retrieving the icon's ID when that icon is extracted from an executable file.
Syntax
HICON ExtractAssociatedIconEx( _Reserved_ HINSTANCE hInst, _Inout_ LPTSTR lpIconPath, _Inout_ LPWORD lpiIconIndex, _Inout_ LPWORD lpiIconId );
Parameters
- hInst [in]
-
Type: HINSTANCE
The handle of the module from which to extract the icon.
- lpIconPath [in, out]
-
Type: LPTSTR
Pointer to a string that, on entry, specifies 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.
When this function returns, if the icon handle was obtained from an executable file (either an executable file directly pointed to by this parameter or an associated executable file) the function stores the full path and file name of that executable in the buffer pointed to by this parameter.
- lpiIconIndex [in, out]
-
Type: LPWORD
Pointer to a WORD value that, on entry, specifies the index of the icon whose handle is to be obtained.
When the function returns, if the icon handle was obtained from an executable file (either an executable file pointed to by lpIconPath or an associated executable file), this value points to the icon's index in that file.
- lpiIconId [in, out]
-
Type: LPWORD
Pointer to a WORD value that, on entry, specifies the ID of the icon whose handle is to be obtained.
When the function returns, if the icon handle was obtained from an executable file (either an executable file pointed to by lpIconPath or an associated executable file), this value points to the icon's ID within that file.
Return value
Type: HICON
Returns the icon's handle if successful, otherwise NULL.
Remarks
The icon handle returned by this function must be released by calling DestroyIcon when it is no longer needed.
Requirements
|
Minimum supported client |
Windows XP [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2003 [desktop apps only] |
|
End of client support |
Windows XP with SP2 |
|
End of server support |
Windows Server 2003 |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names |
ExtractAssociatedIconExW (Unicode) and ExtractAssociatedIconExA (ANSI) |
See also