[shell-coding] Problems with IExtractIcon::Extract
- From: Chris Sutcliffe <ir0nh34d@xxxxxxxxx>
- To: shell-coding <shell-coding@xxxxxxxxxxxxx>
- Date: Thu, 5 Jan 2006 11:19:25 -0500
Hey All,
I've written some code to extract the icons from files:
if (SUCCEEDED(SHGetDesktopFolder(&deskFolder)))
{
if (SUCCEEDED(deskFolder->ParseDisplayName(NULL, NULL, file,
NULL, &pidlLocal, NULL)))
{
pidlTmp = ILFindLastID(pidlLocal);
pidlRelative = ILClone(pidlTmp);
ILRemoveLastID(pidlLocal);
if (SUCCEEDED(deskFolder->BindToObject(pidlLocal, NULL,
IID_IShellFolder, (void**)&appObject)))
{
ILFree(pidlLocal);
if (SUCCEEDED(appObject->GetUIObjectOf(NULL, 1,
(LPCITEMIDLIST*)&pidlRelative,
IID_IExtractIcon, NULL, (void**)&extractIcon)))
{
ILFree(pidlRelative);
if
(SUCCEEDED(extractIcon->GetIconLocation(GIL_FORSHELL, iconLocation,
MAX_PATH, &iconIndex,
&iconFlags)))
{
if (iconSize == 16)
extractIcon->Extract(iconLocation,
iconIndex, NULL, &icon, MAKELONG(16, 16));
else if (iconSize == 48)
extractIcon->Extract(iconLocation,
iconIndex, &icon, NULL, MAKELONG(48, 16));
else
extractIcon->Extract(iconLocation,
iconIndex, &icon, NULL, MAKELONG(32, 16));
extractIcon->Release();
}
}
appObject->Release();
}
}
deskFolder->Release();
}
This works well most of the time (including the handling of regular
shortcuts). The problem I have is that when I attempt the Extact on an
Internet Shortcut, it ends up crashing, despite the fact that iconLocation
and iconIndex are valid. Does anybody have any
ideas?
Thanx!
Chris
--
Chris Sutcliffe
http://emergedesktop.org
Other related posts:
- » [shell-coding] Problems with IExtractIcon::Extract