Hi everyone,
I'm trying to extract program icons out of exe-files. This works using the following Qt function with the path of my exe-file saved in filePath:
image
= new QImage(provider
->icon
(*info
).
pixmap(128,
128).
toImage());
QFileInfo *info = new QFileInfo(filePath);
QFileIconProvider *provider = new QFileIconProvider();
image = new QImage(provider->icon(*info).pixmap(128,128).toImage());
To copy to clipboard, switch view to plain text mode
My problem is, that this function only extracts the smallest iocn the file containst, usually 32 x 32 pixels. Most of todays software provides icons in higher resolution up to 256 x 256, but I can't see a way to set this neither in QFileInfo nor in QFileIconProvider. I found another possibility using the windows API with the function ExtractIconEx:
HICON smallIcon, bigIcon;
WCHAR path;
filePath.toWCharArray(&path);
ExtractIconEx(&path,0,&smallIcon,&bigIcon,1);
HICON smallIcon, bigIcon;
WCHAR path;
filePath.toWCharArray(&path);
ExtractIconEx(&path,0,&smallIcon,&bigIcon,1);
image = new QImage(QPixmap::fromWinHICON(bigIcon).toImage());
To copy to clipboard, switch view to plain text mode
The compiler does't show any errors, but the QImage keeps empty. I hope anybody could help me with extracting larger program-icons out of exe-file. I've tried it in another forum before, but I didn't get any answer at all, so QtCenter appears to have much more promise.
Bookmarks