Problems with IExtractIcon::Extract
Chris Sutcliffe <[email protected]> Thu, 5 Jan 2006 11:19:25 -0500
| Newsgroups | gmane.comp.windows.shell-shocked.devel |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_701_9135783.1136477965147
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
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 =3D ILFindLastID(pidlLocal);
pidlRelative =3D 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 =3D=3D 16)
extractIcon->Extract(iconLocation,
iconIndex, NULL, &icon, MAKELONG(16, 16));
else if (iconSize =3D=3D 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
------=_Part_701_9135783.1136477965147
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Hey All,<br><br>I've written some code to extract the icons from files:<br>=
<br> if (SUCCEEDED(SHGetDesktopFolder(<div id=3D"mb_0">&de=
skFolder)))<br> {<br> if (SUCCEEDED=
(deskFolder->ParseDisplayName(NULL, NULL, file,
<br>NULL, &pidlLocal, NULL)))<br> {<br> &nbs=
p; pidlTmp =3D ILFindLastID(pidlLocal);<b=
r><br> pidlRelative =3D ILClone(pi=
dlTmp);<br> ILRemoveLastID(pidlLoc=
al);<br><br> if (SUCCEEDED(deskFol=
der->BindToObject(pidlLocal, NULL,
<br>IID_IShellFolder, (void**)&appObject)))<br> &n=
bsp; {<br> &n=
bsp;ILFree(pidlLocal);<br><br> &n=
bsp; if (SUCCEEDED(appObject->GetUIObjectOf(NULL, 1,<br>(LPCITEMID=
LIST*)&pidlRelative,<br> &nbs=
p; IID_IExtractIcon, NULL, (void**)&extractIcon)))
<br> {<br> &n=
bsp; ILFree(pidlRela=
tive);<br> &=
nbsp;if<br>(SUCCEEDED(extractIcon->GetIconLocation(GIL_FORSHELL, iconLoc=
ation,<br>MAX_PATH, &iconIndex,<br> =
&iconFlags)))
<br> {=
<br> =
if (iconSize =3D=3D 16)<br> =
extractIcon-=
>Extract(iconLocation,<br>iconIndex, NULL, &icon, MAKELONG(16, 16));=
<br> =
else if (iconSize =3D=3D 48)
<br> =
extractIcon->Extract(iconLocation,<br>iconInd=
ex, &icon, NULL, MAKELONG(48, 16));<br> &nb=
sp; else<br> =
 =
; extractIcon->Extract(iconLocation,<br>
iconIndex, &icon, NULL, MAKELONG(32, 16));<br><br> =
extractIcon-=
>Release();<br> =
}<br> }=
<br><br> appObject-&=
gt;Release();<br> }<br> &nb=
sp; }
<br><br> deskFolder->Release();<br> &n=
bsp;}<br><br>This works well most of the time (including the handling of re=
gular shortcuts). The problem I have is that when I attempt the Extac=
t on an Internet Shortcut, it ends up crashing, despite the fact that iconL=
ocation and iconIndex are valid. Does anybody have any
<br>ideas?<br><br>Thanx!<br><span class=3D"sg"><br>Chris</span></div><br>--=
<br>Chris Sutcliffe<br><a href=3D"http://emergedesktop.org" target=3D"_bla=
nk" onclick=3D"return top.js.OpenExtLink(window,event,this)">http://emerged=
esktop.org
</a>
------=_Part_701_9135783.1136477965147--
__________________________________________________
Subscription options and archive:
http://www.freelists.org/list/shell-coding