"Losing" my icons - what am I missing?
Posted on 2002-05-19
I guess this is not so hard (for 150 points), but URGENT - so the 150 points include an add-on for express delivery :-))
My application uses a system tray icon and I want (it) to be able to display a variety of icons, even some newly loaded from the web.
I have that (mostly) working and I use
newIcon := TIcon.Create;
This works fine when I first use it, but when I want to use the same icon again later on, I get the Windows-logo instead!
(wonder where that comes from?! Probably some really smart M$-default?)
Seems like some associated resource was released? I really don't know...
I store the TIcon-instances in a TStringList (using addObject)
The "handle"-property remains unchanged, but it doesn't work any more...
This does NOT happen to the icons that are embedded in my exe-file and loaded by using LoadIcon(...) - I can use those as often and as long as I want!
What am I missing?
The memory stream is freed, of course. Just for testing, I tried not freeing it, but that didn't make any difference (I hadn't expected it to make a difference, but I'm getting desparate!)
I appreciate any hints! I had the functionality working in 10 minutes and then spent more than an hour with this unexpected problem! I've also read the documentation about icons and some web-pages but couldn't find
anything about that!
Thanks in advance,