You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hi
I am writting program which must extract bitmap icons from Windows with WinApi. Next I will cache them and display with custom library. For now I have simple code (in C++ but it is very simple). But I don't know what to do with HICON - I don't find any function in WinApi which can extract icon from HICON handle. So maybe is there other way?
My current code is like this:
wchar_t* lFile = new wchar_t[lItem->fileName().size() + 1];
lItem->fileName().toWCharArray(lFile);
lFile[lItem->fileName().size()] = 0;
SHFILEINFOW lFileInfo;
HICON lIcon = SHGetFileInfo(lFile, FILE_ATTRIBUTE_NORMAL, &lFileInfo, sizeof(SHFILEINFO), SHGFI_USEFILEATTRIBUTES | SHGFI_ICON | SHGFI_SMALLICON);
delete [] lFile;
lFile = 0;
If you can tell me where is better group or forum to post this message please let me know.
thanks and best regards
Szyk Cech
Rick C. Hodgin
unread,
Feb 15, 2017, 4:47:57 AM2/15/17
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
> I am writting program which must extract bitmap icons from Windows with WinApi. Next I will cache them and display with custom library. For now I have simple code (in C++ but it is very simple). But I don't know what to do with HICON - I don't find any function in WinApi which can extract icon from HICON handle. So maybe is there other way?
Use GetIconInfo()
or with an ImageList(ImageList_Create(), ImageList_AddIcon(),
ImageList_Draw())
Christian Astor
unread,
Feb 15, 2017, 7:06:48 AM2/15/17
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Christian Astor a écrit :
> Use GetIconInfo()
>
> or with an ImageList(ImageList_Create(), ImageList_AddIcon(),
> ImageList_Draw())
...or DrawIcon(Ex) in a DC.
szyk...@gmail.com
unread,
Feb 16, 2017, 2:39:38 PM2/16/17
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
> ...or DrawIcon(Ex) in a DC.
Ok! I can imagine that I create dumb window and print on it an icon. But now other problem arises: how to get width and height of the icon? GetIconInfo(Ex) does not return such information. I must know that info from WinApi because I want icons for files type and icons for exe and dll. Their dimensions can be various so I must get it some how...
szyk...@gmail.com
unread,
Feb 17, 2017, 2:55:29 PM2/17/17
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Ok! Now I found solution of my problem. I dig Qt sources (and after load them to memory I balanced on the edge of insufficient memory) I found in file:
Qt\5.6\Src\qtbase\src\gui\image\qpixmap_win.cpp
Function:
Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon)
Which is fine with me as I planed use Qt library. But without QFileIconProvider bloatware...