Icon in Task Bar
Posted By: cwc
Icon in Task Bar - 07/05/07 12:44
How can I change the task bar icon of a published game? I've tried numerous methods described in various threads on this forum. All methods have something lacking. The one I have been using is changing the acknex.exe file's icon through a resource editor (ResEdit specifically) and then publishing with the new acknex.exe file. This works perfectly except for one problem: The icon that shows in the Windows task bar comes from acknex.dll, not acknex.exe. Using the same resource-editing method with acknex.dll works, but only with the -nc flag and only when launching directly from WED. If I publish the game, even adding the -nc flag to a shortcut that points to the published exe does not work. The engine returns an error saying that the implementation "has been corrupted" (even though -nc should prevent the engine from looking for corruption). So, how can the icon in the Windows task bar be changed in addition to the exe icon?
Posted By: Anonymous
Re: Icon in Task Bar - 07/05/07 17:06
Interesting task!
(i don't think conitec will help you with this

) so
try this
Posted By: LazyDog
Re: Icon in Task Bar - 07/05/07 18:18
you can do this using the Windows API SendMessage function.
you'll need to use the engine variable hWndMain
you'll need to read about how to use LoadIcon
here is a Delphi Example from the SDK Samples. This example is loading the new icon from a resource file.
// Uses icon from resource file (.rc) for the A7 Engine window.
SendMessage(ev.hWndMain, WM_SETICON, 1, LoadIcon(MainInstance, 'PROGICON'));
Posted By: cwc
Re: Icon in Task Bar - 07/05/07 20:53
Mercuryus, you are my hero. Your demo app was extremely helpful. I now call the function to change the icon in the first line in my main function, and the icon changes immediately. Unfortunately, I still have the problem of the A6 icon appearing while C-script is being compiled and the splash screen is showing, before the main function actually begins executing. Any ideas for how I could change the acknex.dll icon even before the C-Script has finished compiling? Again, I can't thank you enough for this concise and highly effective demo app.
Posted By: Anonymous
Re: Icon in Task Bar - 07/05/07 21:01
Quote:
Again, I can't thank you enough for this concise and highly effective demo app
...and the dll I wrote for you (and me
.
Your welcome!
To hide the startup sequence (before accessing the main windows icon) is a more tricky task. You would need a starter application that starts the game hidden (no icon at all) and switch to it after loading. Thats too much for me 
Posted By: jcl
Re: Icon in Task Bar - 07/06/07 06:13
If you're using an external DLL, you can put the icon switching message call in the DllMain call. It's executed before compiling.
Posted By: Anonymous
Re: Icon in Task Bar - 07/06/07 08:01
Thanx, I will try this...
Posted By: cwc
Re: Icon in Task Bar - 07/06/07 09:30
Mercuryus, I don't want to ask too much, since your demo and dll have already helped so much, but if you do decide to give the dllmain fix jcl suggested a try, I'd love to get a copy. Otherwise, I'll see if I can create some sort of "proxy dll" that calls your original dll from dllmain. Many thanks again.
Posted By: Anonymous
Re: Icon in Task Bar - 07/06/07 15:52
download the zip again.
now the icon is changed automatically (DLLMAIN) to ICON.ico if it exists.
Unfortunately the blue A7-Icon is still visible for a moment.
Posted By: Joey
Re: Icon in Task Bar - 07/06/07 16:14
Quote:
If you're using an external DLL, you can put the icon switching message call in the DllMain call. It's executed before compiling.
thanks, interesting news. at which state is the engine window created? after engine_bind()?
Posted By: cwc
Re: Icon in Task Bar - 07/06/07 22:33
Thanks for the dll update. The demo.exe crashed when I tried to launch it, but the new dll works in my own code. The icon is switched to icon.ico as soon as the dll is loaded. The only problem is that the dll is still loaded after the engine compiles the script instead of before. I suspect this is because I'm still on the 6.40 version of the engine. Apparently the pre-compile dllmain call is a new development. I'll try migrating to 6.60 and test again to see if the pre-compile call was implemented in 6.60. If not, then it must be new in A7. (I'm not quite ready to trust my release to a beta version of the engine though.) Many thanks again. You've got my 5-star rating for this one.
Posted By: cwc
Re: Icon in Task Bar - 07/20/07 00:30
FYI for anyone else facing this problem: After migrating to A6 6.60, the dll is not loaded before the engine compiles the C-Script, so the 3dgs icon remains for as long as the splash screen is present and the code is compiling. Presumably A7 switches the icons before the code compile. I just haven't verified this. When A7 is stable enough to come out of Beta, I'll give it a try.
In the meantime, if anyone else has any ideas for how to control the engine's icon in the taskbar from the moment the engine starts up, I'm sure there are many others out there who would be interested. It's rather embarrassing to put a product on the market and the first thing the customer sees is another company's generic icon while the splash screen loads the game. (Honestly, icon control should have been a no-brainer feature for Conitec's product marketing department years ago.)