News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

how to custom a trayicon please?

Started by winge, August 09, 2006, 03:48:52 PM

Previous topic - Next topic

winge

on <tute23> example: when minimized the window to tray bar, there is an default icon i don't know how to custom it ... i tried whole night on it, but i didn't success ... can somebody give me some help please? thanks in advanced!  ::)

PBrennick

winge,

            invoke LoadIcon,NULL,IDI_WINLOGO
            mov note.hIcon,eax


The above code is loading a windows default icon.  You need to define your properly sized icon as a resource in the .rc file you will create.  Then use LoadIcon to get its handle and copy it into the structure for use.

hth,
Paul

The GeneSys Project is available from:
The Repository or My crappy website

winge

hi Paul,

thx for your reply! could you show me an example of "define a properly sized icon as a resource in the .rc file" on <tute23> please? i tried an hour on this 2 line, still can't figure out how to do it.... it seemed if i changed the line, there will be no icon shown amymore when i minimized the program on tray  :red

Tedd

Get your .ico file..
Put a line in your .rc file to include that icon:  100 ICON "youricon.ico"
Then in the code: "invoke LoadIcon,hInst,100" to load the icon, and then just save its handle as normal :wink
No snowflake in an avalanche feels responsible.

winge

Quote from: Tedd on August 10, 2006, 10:49:50 AM
Get your .ico file..
Put a line in your .rc file to include that icon:  100 ICON "youricon.ico"
Then in the code: "invoke LoadIcon,hInst,100" to load the icon, and then just save its handle as normal :wink
thank you Tedd, but the icon i wanna change is the one on the traybar below .... not only the toolbar and captionbar ... could you give me some more help please ... :red

http://img92.imageshack.us/img92/3207/trayiconmd0.th.jpg

Tedd

This will be easier for both of us if you post your code (and all the other files required)
:P
No snowflake in an avalanche feels responsible.

winge

yes Tedd, please have a look on the code below. thank you in advanced  :P

[attachment deleted by admin]

Tedd

That wasn't 'your' code, it was Iczelions :bdg
Anyway, the reason you're having trouble with it is because the icon included with it actually contains multiple icon images.

Try this one instead.. (attachment)


[attachment deleted by admin]
No snowflake in an avalanche feels responsible.

winge

Quote from: Tedd on August 11, 2006, 11:55:16 AM
That wasn't 'your' code, it was Iczelions :bdg
Anyway, the reason you're having trouble with it is because the icon included with it actually contains multiple icon images.

Try this one instead.. (attachment)

thank you Tedd for the code sample! it's a great help!

*ps: i did mention the orginal source code is from the <tute23> example. i am sorry for missed mention "Iczelions" :'(