Hallo,
Delphi-Quellcode:
SHGetFileInfo(pchar('*.htm'), FILE_ATTRIBUTE_NORMAL, sfi, sizeof(sfi),
SHGFI_ICON OR SHGFI_USEFILEATTRIBUTES);
liefert bei mir "4" zurück, Deine Funktion liefert "0", ich kenne zwar den Index der Icons nicht, aber ich denke mal es dürfte stimmen.
Ersetzte mal den 2. Parameter (Deine 1) durch FILE_ATTRIBUTE_NORMAL und es müßte klappen...
GRUND (schlag nach bei
msdn.microsoft.com):
Zitat:
pszPath
[in] Pointer to a null-terminated string of maximum length MAX_PATH that contains the path and file name. Both absolute and relative paths are valid.
If the uFlags parameter includes the SHGFI_PIDL flag, this parameter must be the address of an ITEMIDLIST (PIDL) structure that contains the list of item identifiers that uniquely identifies the file within the Shell's namespace. The pointer to an item identifier list (PIDL) must be a fully qualified PIDL. Relative PIDLs are not allowed.
If the uFlags parameter includes the SHGFI_USEFILEATTRIBUTES flag, this parameter does not have to be a valid file name. The function will proceed as if the file exists with the specified name and with the file attributes passed in the dwFileAttributes parameter. This allows you to obtain information about a file type by passing just the extension for pszPath and passing FILE_ATTRIBUTE_NORMAL in dwFileAttributes.
This string can use either short (the 8.3 form) or long file names.
dwFileAttributes
[in] Combination of one or more file attribute flags (FILE_ATTRIBUTE_ values as defined in
Winnt.h). If uFlags does not include the SHGFI_USEFILEATTRIBUTES flag, this parameter is ignored.