Window Icon
by Quinton Delpeche · in Torque Game Engine Advanced · 08/06/2008 (6:05 am) · 2 replies
I have been racking my brain over this for a little while now and I am getting nowhere. Before I continue let me just clarify, I am talking about the icon that appears on the Top Left of the Window frame and not the executable icon ... my executable icon is correct and working 100%.
I basically want to put the correct icon on the left side of the window and not the boring default one that seems to show on all the TGEA windows. I have checked both TGEA 1.7.0 and TGEA 1.7.1 and my game they both appear like this:

Now the MS Windows resource indicates the following:
So off I head into code land and look for the "hIcon" and "hIconSm" calls and they are set to be equal to appIcon ... which in turn is set to be equal to the following: "HICON appIcon = LoadIcon(appInstance, MAKEINTRESOURCE(IDI_ICON1));"
But this doesn't actually the set the small window icon. So I changed it to read as follows:
But this didn't work either ... is there something I am missing or does anybody have another suggesstion that I can try. Even if I set the appIcon = NULL, I still get an icon on my executable, my task bar, and the incorrect icon on the window is still there ... this shouldn't be like that.
I suspect Torque is overriding the icon somewhere but I am not sure where.
I basically want to put the correct icon on the left side of the window and not the boring default one that seems to show on all the TGEA windows. I have checked both TGEA 1.7.0 and TGEA 1.7.1 and my game they both appear like this:
Now the MS Windows resource indicates the following:
Quote:By default, the operating system provides a simple icon named IDI_APPLICATION. To use it, you pass it to the LoadIcon() function with the hInstance argument set to NULL. Instead of LoadIcon(), Microsoft suggests you use the LoadImage() function.
So off I head into code land and look for the "hIcon" and "hIconSm" calls and they are set to be equal to appIcon ... which in turn is set to be equal to the following: "HICON appIcon = LoadIcon(appInstance, MAKEINTRESOURCE(IDI_ICON1));"
But this doesn't actually the set the small window icon. So I changed it to read as follows:
classInfo.hIcon = static_cast<HICON>(LoadImage(appInstance, MAKEINTRESOURCE(IDI_ICON1), IMAGE_ICON, 32, 32, LR_DEFAULTSIZE)); classInfo.hIconSm = static_cast<HICON>(LoadImage(appInstance, MAKEINTRESOURCE(IDI_ICON1), IMAGE_ICON, 16, 16, LR_DEFAULTSIZE));
But this didn't work either ... is there something I am missing or does anybody have another suggesstion that I can try. Even if I set the appIcon = NULL, I still get an icon on my executable, my task bar, and the incorrect icon on the window is still there ... this shouldn't be like that.
I suspect Torque is overriding the icon somewhere but I am not sure where.
About the author
Gobbo Games is an Independent Games Development company operating from Durban in South Africa. We believe in creating high-quality cost-effective games that remain true to the belief of Independent Game Developers around the world.
Torque Owner Quinton Delpeche
Gobbo Games
The file T3D/resource.h has the following code in it at around lines 6 & 7:
The Torque.rc file refers to the following at around line 3:
The file windowManager\win32\win32Window.cpp has the following code in it at around lines 36.
As you can see 107 refers to a non-existant resource in the system, hence the default windows icon being displayed.
Change the above to refer to the correct resoource as indicated below and your icons are working again:
I hope this helps someone else. :)