Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » al_set_display_icon() from executable

This thread is locked; no one can reply to it. rss feed Print
al_set_display_icon() from executable
Desmond Taylor
Member #11,943
May 2010
avatar

Okay, I've added the icon to the executable using a resource file and don't want to also include it as a png. Is there a way I can get the icon from the executable file and use al_set_display_icon() on it?

Evert
Member #794
November 2000
avatar

Why do you need to call al_set_display_icon() if the icon is already embedded in the executable?

Desmond Taylor
Member #11,943
May 2010
avatar

To set the window icon :) I want my game to run in both fullscreen and windoed mode and in windowed I need the icon to be attached to the window.

Evert
Member #794
November 2000
avatar

Shouldn't it automatically set the icon to the one that's associated with the program? That's what I'd expect anyway.
I guess you're using Windows though, and I have no idea how this works there...

Desmond Taylor
Member #11,943
May 2010
avatar

No it doesn't :( And yea I'm using Windows 7 32bit.

Elias
Member #358
May 2000

The problem is likely this line: http://allefant.com/gtags/S/2046.html#L868

If someone knows how to instead set the .exe icon there that would be nice of course. For now it should be easy enough providing the icon as a .png file and setting with al_set_display_icon though.

--
"Either help out or stop whining" - Evert

Thomas Fjellstrom
Member #476
June 2000
avatar

A4 has a mechanism that let you include an "allegro_icon" resource that it would load and set for the window initially. We should probably do something similar for A5.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Desmond Taylor
Member #11,943
May 2010
avatar

Elias said:

For now it should be easy enough providing the icon as a .png file and setting with al_set_display_icon though.

I really want to try and avoid that.

A4 has a mechanism that let you include an "allegro_icon" resource that it would load and set for the window initially. We should probably do something similar.

Did that use the icon from the executable?

Trent Gamblin
Member #261
April 2000
avatar

The allegro_icon thing is the executable icon. Windows has two different icons you want to set. The first one is the executable icon that will show in Explorer. The window titlebar icon is set with al_set_display_icon.

Edit: If you don't want to include a png file you could use the memfile addon to load a png from a binary dump (into a header file).

Desmond Taylor
Member #11,943
May 2010
avatar

If you don't want to include a png file you could use the memfile addon to load a png from a binary dump (into a header file).

I really have no idea where to start with that. Any chance you can give me an example?

Elias
Member #358
May 2000

A4 has this in the same line instead of NULL:

wnd_class.hIcon = LoadIcon(allegro_inst, "allegro_icon");

--
"Either help out or stop whining" - Evert

Go to: