{"id":464,"date":"2017-09-20T20:03:59","date_gmt":"2017-09-20T19:03:59","guid":{"rendered":"http:\/\/510245153.swh.strato-hosting.eu\/?p=464"},"modified":"2017-09-20T20:12:01","modified_gmt":"2017-09-20T19:12:01","slug":"get-large-icon-from-a-dll-or-executable-xp","status":"publish","type":"post","link":"https:\/\/thomas-jansen.eu\/?p=464","title":{"rendered":"Get large icon from a dll or executable (XP+)"},"content":{"rendered":"<p>To get a large icon from a DLL or executable use SHDefExtractIcon from the shell32.lib<\/p>\n<p>HRESULT SHDefExtractIcon(<br \/>\n_In_ LPCTSTR pszIconFile,<br \/>\nint iIndex,<br \/>\n_In_ UINT uFlags,<br \/>\n_Out_opt_ HICON *phiconLarge,<br \/>\n_Out_opt_ HICON *phiconSmall,<br \/>\nUINT nIconSize<br \/>\n);<\/p>\n<p>This function is supported since Windows XP.<\/p>\n<p>Icon size contains the required size in pixels. Use MAKELPARAM(large icon size, small icon size) macro to get the correct value. Icons will be resized to the requested size. Use 0 to get the default size.<\/p>\n<p>Sample code:<\/p>\n<p>SHDefExtractIcon(L&#8221;c:\\\\Windows\\\\System32\\\\shell32.dll&#8221;, 0,0, &amp;iconLarge, &amp;iconsSmall, MAKELPARAM(256, 0));<\/p>\n<p>\/\/To check the size, colordeph<br \/>\nICONINFO iconInfo = { 0 };<br \/>\nGetIconInfo(iconLarge, &amp;iconInfo);<br \/>\nBITMAP bitmap = { 0 };<br \/>\nGetObject(iconInfo.hbmColor, sizeof(BITMAP), &amp;bitmap);<\/p>\n<p>DestroyIcon(smallIcon);<br \/>\nDestroyIcon(largeIcon);<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To get a large icon from a DLL or executable use SHDefExtractIcon from the shell32.lib HRESULT SHDefExtractIcon( _In_ LPCTSTR pszIconFile, int iIndex, _In_ UINT uFlags, _Out_opt_ HICON *phiconLarge, _Out_opt_ HICON *phiconSmall, UINT nIconSize ); This function is supported since Windows XP. Icon size contains the required size in pixels. Use MAKELPARAM(large icon size, small icon [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-464","post","type-post","status-publish","format-standard","hentry","category-win3264-api-c"],"_links":{"self":[{"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=\/wp\/v2\/posts\/464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=464"}],"version-history":[{"count":4,"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=\/wp\/v2\/posts\/464\/revisions"}],"predecessor-version":[{"id":473,"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=\/wp\/v2\/posts\/464\/revisions\/473"}],"wp:attachment":[{"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}