ExtractIcon

3.1

  #include <shellapi.h>    

  HICON ExtractIcon(hinst, lpszExeName, iIcon)    
  HINSTANCE hinst; /* instance handle, */  
  LPCSTR lpszExeName; /* address of string for file */
  UINT iIcon; /* index of icon to retrieve */

The ExtractIcon function retrieves the handle of an icon from a specified executable file, dynamic-link library (DLL), or icon file.

Parameters

hinst

Identifies the instance of the application calling the function.

lpszExeName

Points to a null-terminated string specifying the name of an executable file, dynamic-link library, or icon file.

iIcon

Specifies the index of the icon to be retrieved. If this parameter is zero, the function returns the handle of the first icon in the specified file. If the parame-ter is –1, the function returns the total number of icons in the specified file.

Return Value

The return value is the handle of an icon if the function is successful. It is 1 if the file specified in the lpszExeName parameter is not an executable file, dynamic-link library, or icon file. Otherwise, it is NULL, indicating that the file contains no icons.