The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: bloodhound on April 27, 2006, 01:01:54 PM

Title: Dynamically changing system tray icon and the on hover text display??
Post by: bloodhound on April 27, 2006, 01:01:54 PM
when you hover the mouse on your system tray application. how do you change its
display text. as in like your program has a "running" or "idle" plus changing the icon dynamically??

thanks!
Title: Re: Dynamically changing system tray icon and the on hover text display??
Post by: Tedd on April 27, 2006, 01:54:10 PM
A simple way would be to catch the WM_MOUSEMOVE message within your tray notification message - this will tell you that the mouse pointer is over your icon, and the tooltip may be shown at this point. So then you can set the tooltip's text (NOTIFYICONDATA.szTip) through Shell_NotifyIcon.

A possible alternative would be if you could catch TTN_GETDISPINFO, which is sent inside WM_NOTIFY -- though I haven't tested this, so I'm not sure if you will even get to see this message.
Title: Re: Dynamically changing system tray icon and the on hover text display??
Post by: bloodhound on April 28, 2006, 02:17:03 AM
thanks Tedd, but i guess ill try the hard way,

does someone have a short sample code for this??
Title: Re: Dynamically changing system tray icon and the on hover text display??
Post by: zcoder on April 28, 2006, 03:36:50 AM
Let me see if I can explain this so it will be fully understanable.
the below code is how you would create a shell notify,notic the NIM_ADD
when you get the WM_SHELLNOTIFY message place this same code in there but change NIM_ADD to  NIM_MODIFY
then just change the tooltip and icon. you will get this message also under WM_MOUSEMOVE


         mov note.cbSize,sizeof NOTIFYICONDATA
          push hWin
          pop note.hwnd
          mov note.uID,IDI_TRAY
          mov note.uFlags,NIF_ICON+NIF_MESSAGE+NIF_TIP
          mov note.uCallbackMessage,WM_SHELLNOTIFY
mov eax,hIcon
          mov note.hIcon,eax
          invoke lstrcpy,addr note.szTip,addr szDisplayName
          invoke Shell_NotifyIcon,NIM_ADD,addr note


If this is not clear to you, let me know and I will try to make a simple program to show how this is done.

Zcoder....
Title: Re: Dynamically changing system tray icon and the on hover text display??
Post by: bloodhound on April 28, 2006, 06:50:01 AM
Thanks! yes but i already got this,

i think i have another problem re this, how do you animate the tray icon?

you just load and load and change it alternately like flipping or animation?


and also the Balloon help in ME and XP systems...  what command is that???

like when you first install XP there's a balloon saying "Take a tour on Windows XP" on the tray icon..
:bg
Title: Re: Dynamically changing system tray icon and the on hover text display??
Post by: MichaelW on April 28, 2006, 08:14:35 AM
bloodhound,

You might take a look at the code for the three HDD activity monitors that have been posted, one by me, and now two much better ones by Phoenix. The attachment is a version with a 5-step animated icon that I rejected because of unacceptable flicker under Windows 2000.



[attachment deleted by admin]
Title: Re: Dynamically changing system tray icon and the on hover text display??
Post by: zcoder on April 28, 2006, 09:23:43 AM
MichaelW,

That example is not really done the right way, also the timer is too fast should be 1000 for 1 sec.
to avoid flicker, but it still is not done right.

also a clue to the balloon tooltip:

uFlags = NIF_INFO
Use a balloon ToolTip instead of a standard ToolTip. The szInfo, uTimeout, szInfoTitle, and dwInfoFlags members are valid.


Zcoder....
Title: Re: Dynamically changing system tray icon and the on hover text display??
Post by: bloodhound on April 28, 2006, 12:13:50 PM
@ MichaelW

Ok, Thanks a lot! i will check it and see how it works, BTW my system is ME.


@zcoder

can you give me details or a small example on this balloon tip? thanks! :thumbu
Title: Re: Dynamically changing system tray icon and the on hover text display??
Post by: bloodhound on April 30, 2006, 01:55:27 AM
@Zcoder


i dont see any NIF_INFO in my windows.inc, of course compiles with errors
am using masm7...
Title: Re: Dynamically changing system tray icon and the on hover text display??
Post by: zcoder on April 30, 2006, 11:52:49 AM
bloodhound,
When I read the MSDN I did not realize that this stuff is missing from
windows.inc and I tried for over 24 Hours to create a example on
using baloon tooltips, but I could not get it to work. So far to
date this is the only thing I have found in the MSDN that I can't
get to work.

I am sure I will find other things in the MSDN that I can't understand.
SHELLICONDATA has been inlarged with other items in it and some
equates have been add like:
NIF_INFO equ 10h
NIN_BALLOONSHOW equ WM_USER+2
NIIF_INFO equ 1
NOTIFYICON_OLDVERSION equ 0;
NOTIFYICON_VERSION equ 3;

I will have to work on this for awhile to figure this out.
I am adding all this to my windows.inc project as well.

This is the same problem I had with making a web cam
example, but I got that to work so I hope to have this figured out too.
Zcoder....
Title: Re: Dynamically changing system tray icon and the on hover text display??
Post by: hutch-- on April 30, 2006, 11:55:35 AM
Balloon tip with thanks to "anon"

[attachment deleted by admin]
Title: Re: Dynamically changing system tray icon and the on hover text display??
Post by: zcoder on April 30, 2006, 12:00:08 PM
hutch-- ,
Thats is the wrong type
we are trying to make shell icon tooltips
you know down by the clock?

Zcoder....
Title: Re: Dynamically changing system tray icon and the on hover text display??
Post by: Phoenix on April 30, 2006, 12:23:03 PM
Perhaps this helps:
http://www.codeproject.com/shell/StealthDialog.asp
Title: Re: Dynamically changing system tray icon and the on hover text display??
Post by: bloodhound on May 02, 2006, 05:44:19 AM


Thanks to you all guys!!

but i finally got it!  oh wow!! :clap:



http://www.masmforum.com/simple/index.php?topic=4679.0