[AD] Application icon in Windows

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Quoting the Allegro documentation:

\begin{quote}
When creating the main window, Allegro searches the executable for an ICON
resource named "allegro_icon". If it is present, Allegro automatically
loads it and uses it as its application icon. Otherwise, Allegro uses the
default IDI_APPLICATION icon.
\end{quote}

I take it this implies that Allegro first looks for a resource named
`allegro_icon' and then for one named `IDI_APPLICATION'. However, if it
doesn't find `allegro_icon', it uses a default Windows icon even if the
resources for the program specify IDI_APPLICATION. At least, that's what
happens under MinGW.

I've attached a patch that makes Allegro check the IDI_APPLICATION resource
for the running program prior to falling back on the Windows default.
--- all3938\src\win\wwnd.c	Sun Sep 16 18:31:56 2001
+++ allegro\src\win\wwnd.c	Sun Sep 16 18:40:20 2001
@@ -358,6 +358,8 @@
    wnd_class.hInstance = allegro_inst;
    wnd_class.hIcon = LoadIcon(allegro_inst, "allegro_icon");
    if (!wnd_class.hIcon)
+      wnd_class.hIcon = LoadIcon(allegro_inst, IDI_APPLICATION);
+   if (!wnd_class.hIcon)
       wnd_class.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wnd_class.hCursor = LoadCursor(NULL, IDC_ARROW);
    wnd_class.hbrBackground = CreateSolidBrush(0);
-- 
Evert Glebbeek, Physics student
Faculty of science, University of Amsterdam
e-mail: eglebbk@xxxxxxxxxx   ICQ: 48210348
www: http://www.science.uva.nl/~eglebbk/ 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/