If you are using Qt, then you will be using the Unicode libraries, so SHGetFileInfo will be aliased to SHGetFileInfoW, which although the prototype will be LPCTSTR, you can (and should) use a Unicode string provided by utf16()
Let me dig out an example from one of my apps... [structure and error checking removed]
HIMAGELIST ImageList;
HICON WinIcon;
ImageList
= (HIMAGELIST
) SHGetFileInfo
((const WCHAR
*)QDir::toNativeSeparators(ee
->filePath
).
utf16(),
0,
&FileInfo,
sizeof(SHFILEINFO
), SHGFI_LARGEICON|SHGFI_SYSICONINDEX
);
WinIcon = ImageList_GetIcon(ImageList, FileInfo.iIcon, ILD_NORMAL);
HIMAGELIST ImageList;
HICON WinIcon;
ImageList = (HIMAGELIST) SHGetFileInfo((const WCHAR *)QDir::toNativeSeparators(ee->filePath).utf16(), 0, &FileInfo, sizeof(SHFILEINFO), SHGFI_LARGEICON|SHGFI_SYSICONINDEX);
WinIcon = ImageList_GetIcon(ImageList, FileInfo.iIcon, ILD_NORMAL);
To copy to clipboard, switch view to plain text mode
Bookmarks