<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Große Icons mit IExtractIcon]]></title><description><![CDATA[<p>Also ich versuche gerade Icons mit (vistaoiden) 128x128 pixeln zu extrahieren, das einzige, was ich dabei bekomme sind normalgroße icons, obwohl die im explorer auch die größe on 128px haben.</p>
<p>Vielleicht hat irgendwer schon einmal damit gearbeitet oder etwas derartiges also will ich mal den code posten und hoffe auf vorschläge, und bin dankbar für dergleichen produktiver art...</p>
<p>Zum code: Die kommentare sind leider aber gottes in (pseudo-)englisch gehalten,<br />
da das allgemein zu dem im englisch gehaltenen C++ passt</p>
<pre><code class="language-cpp">// Gets the temp folder
WCHAR Path0[MAX_PATH + 1] = {0};
GetTempPath(MAX_PATH, Path0);
// Create a temp file with the same extension
WCHAR Path[MAX_PATH] = {0};
GetTempFileName(Path0, L&quot;EIT&quot;, GetTickCount(), Path);
PathRemoveExtension(Path);
PathAddExtension(Path, PathFindExtension(lpFileName));
CloseHandle(CreateFile(Path, GENERIC_READ, 0, NULL, CREATE_ALWAYS, 0, NULL));
// Obtain the pidl for the temp file
IShellFolder* lpShf;
SHGetDesktopFolder(&amp;lpShf);
LPITEMIDLIST pIdl;
lpShf-&gt;ParseDisplayName(NULL, NULL, Path0, NULL, &amp;pIdl, NULL);
// Get the temp folder
IShellFolder* lpShf2;
lpShf-&gt;BindToObject(pIdl, NULL, __uuidof(IShellFolder), (void**)&amp;lpShf2);
lpShf-&gt;Release();
CoTaskMemFree(pIdl);
// Parse the file name
lpShf2-&gt;ParseDisplayName(NULL, NULL, wcsrchr(Path, L'\\') + 1, NULL, &amp;pIdl, NULL);
// Get the IExtractIcon interface
IExtractIcon* lpExi;
lpShf2-&gt;GetUIObjectOf(NULL, 1, (LPCITEMIDLIST*)&amp;pIdl, __uuidof(IExtractIcon), NULL, (void**)&amp;lpExi);
lpShf2-&gt;Release();
CoTaskMemFree(pIdl);
// Get the icon location
WCHAR Path2[MAX_PATH + 1] = {0};
int ind;
UINT uFlags;
HRESULT hr = lpExi-&gt;GetIconLocation(0, Path2, MAX_PATH, &amp;ind, &amp;uFlags);
// Extract the icon from its location
HICON hIc;
if(hr == S_OK)
	lpExi-&gt;Extract(Path2, ind, &amp;hIc, NULL, MAKELONG(128, 16));
else if(hr == S_FALSE)
{
	// Use the standard icon
	SHFILEINFO sfi = {0};
	SHGetFileInfo(Path, 0, &amp;sfi, sizeof(sfi), SHGFI_ICON | SHGFI_LARGEICON);
	hIc = sfi.hIcon;
}
else
{
	WORD w1 = 0;
	hIc = ExtractAssociatedIcon(NULL, Path, &amp;w1);
}
// Cleanup
lpExi-&gt;Release();
// Remove the temp file
DeleteFile(Path);
// Load the icon into a bitmap(128x128)
pBmp = new Gdiplus::Bitmap(hIc);
Gdiplus::Image* pImg = pBmp-&gt;GetThumbnailImage(128, 128);
delete pBmp;
pBmp = (Gdiplus::Bitmap*)pImg;
DestroyIcon(hIc);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/188237/große-icons-mit-iextracticon</link><generator>RSS for Node</generator><lastBuildDate>Fri, 03 Jul 2026 14:39:03 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/188237.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 29 Jul 2007 14:09:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Große Icons mit IExtractIcon on Sun, 29 Jul 2007 14:09:23 GMT]]></title><description><![CDATA[<p>Also ich versuche gerade Icons mit (vistaoiden) 128x128 pixeln zu extrahieren, das einzige, was ich dabei bekomme sind normalgroße icons, obwohl die im explorer auch die größe on 128px haben.</p>
<p>Vielleicht hat irgendwer schon einmal damit gearbeitet oder etwas derartiges also will ich mal den code posten und hoffe auf vorschläge, und bin dankbar für dergleichen produktiver art...</p>
<p>Zum code: Die kommentare sind leider aber gottes in (pseudo-)englisch gehalten,<br />
da das allgemein zu dem im englisch gehaltenen C++ passt</p>
<pre><code class="language-cpp">// Gets the temp folder
WCHAR Path0[MAX_PATH + 1] = {0};
GetTempPath(MAX_PATH, Path0);
// Create a temp file with the same extension
WCHAR Path[MAX_PATH] = {0};
GetTempFileName(Path0, L&quot;EIT&quot;, GetTickCount(), Path);
PathRemoveExtension(Path);
PathAddExtension(Path, PathFindExtension(lpFileName));
CloseHandle(CreateFile(Path, GENERIC_READ, 0, NULL, CREATE_ALWAYS, 0, NULL));
// Obtain the pidl for the temp file
IShellFolder* lpShf;
SHGetDesktopFolder(&amp;lpShf);
LPITEMIDLIST pIdl;
lpShf-&gt;ParseDisplayName(NULL, NULL, Path0, NULL, &amp;pIdl, NULL);
// Get the temp folder
IShellFolder* lpShf2;
lpShf-&gt;BindToObject(pIdl, NULL, __uuidof(IShellFolder), (void**)&amp;lpShf2);
lpShf-&gt;Release();
CoTaskMemFree(pIdl);
// Parse the file name
lpShf2-&gt;ParseDisplayName(NULL, NULL, wcsrchr(Path, L'\\') + 1, NULL, &amp;pIdl, NULL);
// Get the IExtractIcon interface
IExtractIcon* lpExi;
lpShf2-&gt;GetUIObjectOf(NULL, 1, (LPCITEMIDLIST*)&amp;pIdl, __uuidof(IExtractIcon), NULL, (void**)&amp;lpExi);
lpShf2-&gt;Release();
CoTaskMemFree(pIdl);
// Get the icon location
WCHAR Path2[MAX_PATH + 1] = {0};
int ind;
UINT uFlags;
HRESULT hr = lpExi-&gt;GetIconLocation(0, Path2, MAX_PATH, &amp;ind, &amp;uFlags);
// Extract the icon from its location
HICON hIc;
if(hr == S_OK)
	lpExi-&gt;Extract(Path2, ind, &amp;hIc, NULL, MAKELONG(128, 16));
else if(hr == S_FALSE)
{
	// Use the standard icon
	SHFILEINFO sfi = {0};
	SHGetFileInfo(Path, 0, &amp;sfi, sizeof(sfi), SHGFI_ICON | SHGFI_LARGEICON);
	hIc = sfi.hIcon;
}
else
{
	WORD w1 = 0;
	hIc = ExtractAssociatedIcon(NULL, Path, &amp;w1);
}
// Cleanup
lpExi-&gt;Release();
// Remove the temp file
DeleteFile(Path);
// Load the icon into a bitmap(128x128)
pBmp = new Gdiplus::Bitmap(hIc);
Gdiplus::Image* pImg = pBmp-&gt;GetThumbnailImage(128, 128);
delete pBmp;
pBmp = (Gdiplus::Bitmap*)pImg;
DestroyIcon(hIc);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1334366</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1334366</guid><dc:creator><![CDATA[Dennis123]]></dc:creator><pubDate>Sun, 29 Jul 2007 14:09:23 GMT</pubDate></item><item><title><![CDATA[Reply to Große Icons mit IExtractIcon on Sun, 29 Jul 2007 14:11:44 GMT]]></title><description><![CDATA[<p>Nachtrag:<br />
Die HRESULTS werden gerade noch alle ignoriert, aber beim debugen haben alle immer S_OK zurückgegeben</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1334367</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1334367</guid><dc:creator><![CDATA[Dennis123]]></dc:creator><pubDate>Sun, 29 Jul 2007 14:11:44 GMT</pubDate></item><item><title><![CDATA[Reply to Große Icons mit IExtractIcon on Sun, 29 Jul 2007 16:11:08 GMT]]></title><description><![CDATA[<p>Zudem möchte ich sagfen, dass ich es auch mit IExtractImage versucht habe, wobei mir dann aber eine exception entgegengekommen ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1334426</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1334426</guid><dc:creator><![CDATA[Dennis123]]></dc:creator><pubDate>Sun, 29 Jul 2007 16:11:08 GMT</pubDate></item><item><title><![CDATA[Reply to Große Icons mit IExtractIcon on Sun, 29 Jul 2007 17:25:39 GMT]]></title><description><![CDATA[<p>Zu der exception:<br />
Mir ist dabei etwas frappierendes aufgefallen:<br />
Die ex. ist eine AccessViolation, die immer an der stelle MAX_PATH stattfindet!</p>
<pre><code class="language-cpp">HRESULT GetLocation(
    LPWSTR pszPathBuffer,
    DWORD cchMax,   // &lt;----- dieser parameter wird als pointer benutzt!
    DWORD *pdwPriority,
    const SIZE *prgSize,
    DWORD dwRecClrDepth,
    DWORD *pdwFlags
);
</code></pre>
<p>Wenn man für die länge des string z.B. eine kleinere zahl eingibt, kommt jeweils die entsprechende stelle als av bei raus.</p>
<p>Zum aufruf habe ich jetzt auch noch das passende assembler stück parat(vielleicht macht der compiler was falsch...)</p>
<pre><code class="language-asm">;lpExi-&gt;GetLocation(Path2, MAX_PATH, &amp;dw1, &amp;s1, 32, &amp;dw2);
000000014001ECEB  mov         rax,qword ptr [lpExi] 
000000014001ECF3  mov         rax,qword ptr [rax] 
000000014001ECF6  lea         rcx,[dw2] 
000000014001ECFE  mov         qword ptr [rsp+30h],rcx 
000000014001ED03  mov         dword ptr [rsp+28h],20h 
000000014001ED0B  lea         rcx,[s1] 
000000014001ED13  mov         qword ptr [rsp+20h],rcx 
000000014001ED18  lea         r9,[dw1] 
000000014001ED20  mov         r8d,104h 
000000014001ED26  lea         rdx,[Path2] 
000000014001ED2E  mov         rcx,qword ptr [lpExi] 
000000014001ED36  call        qword ptr [rax+18h]
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1334467</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1334467</guid><dc:creator><![CDATA[Dennis123]]></dc:creator><pubDate>Sun, 29 Jul 2007 17:25:39 GMT</pubDate></item><item><title><![CDATA[Reply to Große Icons mit IExtractIcon on Mon, 30 Jul 2007 12:11:37 GMT]]></title><description><![CDATA[<p>Häääääääää?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1334898</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1334898</guid><dc:creator><![CDATA[~~++~~++~~++]]></dc:creator><pubDate>Mon, 30 Jul 2007 12:11:37 GMT</pubDate></item><item><title><![CDATA[Reply to Große Icons mit IExtractIcon on Mon, 30 Jul 2007 18:22:25 GMT]]></title><description><![CDATA[<p>Hää? Wieso hää?<br />
Es ist ganz einfach: Windows macht etwas was es nicht machen sollte,</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1335178</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1335178</guid><dc:creator><![CDATA[Dennis123]]></dc:creator><pubDate>Mon, 30 Jul 2007 18:22:25 GMT</pubDate></item><item><title><![CDATA[Reply to Große Icons mit IExtractIcon on Wed, 01 Aug 2007 12:50:20 GMT]]></title><description><![CDATA[<p>Und ich bin blöd!<br />
Ich hab __uuidof(IExtractIcon) benutzt und das resultat als IExtractImage behandelt.............<br />
Die Erkenntbis kommt spät......</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1336526</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1336526</guid><dc:creator><![CDATA[Dennis123]]></dc:creator><pubDate>Wed, 01 Aug 2007 12:50:20 GMT</pubDate></item></channel></rss>