Icon fichier

Signaler
Messages postés
875
Date d'inscription
samedi 17 mai 2003
Statut
Membre
Dernière intervention
22 juin 2012
-
Messages postés
2070
Date d'inscription
mardi 22 avril 2003
Statut
Membre
Dernière intervention
3 juillet 2006
-
Est ce que qlq1 sait comment récupérer les icones utiliser par les
diférents fichiers, pour l'utiliser dans une liste fichier avec leur
icones approprié ?



Merci

Have Fun ...

1 réponse

Messages postés
2070
Date d'inscription
mardi 22 avril 2003
Statut
Membre
Dernière intervention
3 juillet 2006
8
[mk:@MSITStore:C:\Program%20Files\Microsoft%20Visual%20Studio\MSDN98\98VSa\1036\winui.chm::/devdoc/live/pdui/icons_4m60.htm ExtractIconEx] function.

HICON ExtractIcon(
  HINSTANCE hInst,          // instance handle
  LPCTSTR lpszExeFileName,  // filename of file with icon
  UINT nIconIndex           // index of icon to extract
);
 



Parameters

* hInst : Handle to the instance of the application calling the function.
* lpszExeFileName : Pointer to a null-terminated string specifying the name of an executable file, DLL, or icon file.
* nIconIndex : Specifies the zero-based index of the icon to retrieve. For example, if this value is 0, the function returns a handle to the first icon in the specified file.
If this value is –1, the function returns the total number of icons in the specified file. If the file is an executable file or DLL, the return value is the number of RT_GROUP_ICON resources. If the file is an .ICO file, the return value is 1.
Windows 95, Windows NT 4.0, and later: If this value is a negative number not equal to -1, the function returns a handle to the icon in the specified file whose resource identifier is equal to the absolute value of nIconIndex. For example, use -3 to extract the icon whose resource identifier is 3. To extract the icon whose resource identifier is 1, use the [mk:@MSITStore:C:\Program%20Files\Microsoft%20Visual%20Studio\MSDN98\98VSa\1036\winui.chm::/devdoc/live/pdui/icons_5kxa.htm DestroyIcon] function.






ExtractAssociatedIcon

The ExtractAssociatedIcon function returns a handle to an indexed icon found in a file or an icon found in an associated executable file.

HICON ExtractAssociatedIcon(
  HINSTANCE hInst,    // application instance handle
  LPTSTR lpIconPath,  // path and filename of file for which icon is 
                      // wanted
  LPWORD lpiIcon      // pointer to icon index
);
 



Parameters

* hInst : Specifies the instance of the application calling the function.
* lpIconPath : Pointer to a string that specifies the full path and filename of the file for which an icon is desired. 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 filename of that executable in the string pointed to by lpIconPath.

* lpiIcon : Pointer to a WORD that specifies 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 the WORD pointed to by lpiIcon.

Return Values

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 filename of the executable file in the string pointed to by lpIconPath, and stores the icon's identifier in the WORD pointed to by lpiIcon.


If the function fails, the return value is NULL.


Remarks

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 filename extensions, are stored in the per-user part of the registry, and can be defined using File Manager's Associate command.