<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Executable icons and window icons</title>
		<link>http://www.allegro.cc/forums/view/617605</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sun, 04 Nov 2018 01:01:09 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Did some searching, all I could really find on this was: <a href="https://www.allegro.cc/forums/thread/607514">https://www.allegro.cc/forums/thread/607514</a></p><p>So I already know I can set the icon of the window with al_set_display_icon(), but I never knew how to set the icon for the executable, and the one that shows up on the taskbar.</p><p>Well I just figured it out, and now I&#39;m trying to get it to work with Allegro. I like that I can pack the .ico into the executable so I don&#39;t need to include a separate png file with executable.</p><p>If I create a simple C++ app with an icon resource, the executable, the taskbar, and the window all have the icon, but if I&#39;m using Allegro, the window and the taskbar no longer have an icon.</p><p>Is there anyway for Allegro to let Windows take care of the icon?</p><p>Thanks
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Aksel Huff)</author>
		<pubDate>Fri, 02 Nov 2018 07:45:08 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I don&#39;t think Allegro is self aware enough to detect an embedded icon resource.</p><p>There are ways to embed the resource in the file as a C array, and then you can use al_load_bitmap_f to load it.</p><p>Allegro probably changes the icon when it creates the window, and since its not aware of the icon you embedded, it can&#39;t use it.</p><p>Try embedding the icon as a resource file, and using al_set_display_icon at the same time. It&#39;s not a fix, but it should work.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Fri, 02 Nov 2018 18:40:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>This is the code I use to load the icon resource, the same one that&#39;s displayed as the executable&#39;s icon. This is always the first icon resource defined. It&#39;s called &quot;IDI_ICON1&quot; here, but the name doesn&#39;t matter.</p><div class="source-code snippet"><div class="inner"><pre>    HWND winhandle<span class="k2">;</span>
    HICON icon<span class="k2">;</span>

    <span class="c">/* Create the display here, before setting the icon. */</span>

    icon <span class="k3">=</span> LoadIcon<span class="k2">(</span>GetModuleHandle<span class="k2">(</span>NULL<span class="k2">)</span>, <span class="s">"IDI_ICON1"</span><span class="k2">)</span><span class="k2">;</span>
    <span class="k1">if</span> <span class="k2">(</span>icon<span class="k2">)</span> <span class="k2">{</span>
        winhandle <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_get_win_window_handle"><span class="a">al_get_win_window_handle</span></a><span class="k2">(</span>display<span class="k2">)</span><span class="k2">;</span>
        SetClassLongPtr<span class="k2">(</span>winhandle, GCLP_HICON, <span class="k2">(</span>LONG_PTR<span class="k2">)</span>icon<span class="k2">)</span><span class="k2">;</span>
        SetClassLongPtr<span class="k2">(</span>winhandle, GCLP_HICONSM, <span class="k2">(</span>LONG_PTR<span class="k2">)</span>icon<span class="k2">)</span><span class="k2">;</span>
    <span class="k2">}</span>
</pre></div></div><p>

</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/617605/1039853#target">Aksel Huff</a> said:</div><div class="quote"><p> If I create a simple C++ app with an icon resource, the executable, the taskbar, and the window all have the icon, but if I&#39;m using Allegro, the window and the taskbar no longer have an icon.</p><p> Is there anyway for Allegro to let Windows take care of the icon?</p></div></div><p>What happens is that Explorer loads the first icon resource in the file (first defined in the .rc), and displays that as the program&#39;s icon.</p><p>The window icon and other icons used at runtime are just generic default icons unless you set them to something else. If your C++ program is created in Visual Studio, maybe you were using a template that already had the code for doing that.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Sun, 04 Nov 2018 01:01:09 +0000</pubDate>
	</item>
</rss>
