Dynamically changing system tray icon and the on hover text display??

Started by bloodhound, April 27, 2006, 01:01:54 PM

Previous topic - Next topic

bloodhound

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!

Tedd

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.
No snowflake in an avalanche feels responsible.

bloodhound

thanks Tedd, but i guess ill try the hard way,

does someone have a short sample code for this??

zcoder

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....
Back in 1979, My computer ran so fine.
And there was no such thing,
As a Microsoft Crashed Machine.
http://zcoder.110mb.com
http://www.dietzel.com/partner/idevaffiliate.php?id=345_6  Free Domain Names

bloodhound

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

MichaelW

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]
eschew obfuscation

zcoder

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....
Back in 1979, My computer ran so fine.
And there was no such thing,
As a Microsoft Crashed Machine.
http://zcoder.110mb.com
http://www.dietzel.com/partner/idevaffiliate.php?id=345_6  Free Domain Names

bloodhound

@ 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

bloodhound

@Zcoder


i dont see any NIF_INFO in my windows.inc, of course compiles with errors
am using masm7...

zcoder

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....
Back in 1979, My computer ran so fine.
And there was no such thing,
As a Microsoft Crashed Machine.
http://zcoder.110mb.com
http://www.dietzel.com/partner/idevaffiliate.php?id=345_6  Free Domain Names

hutch--

Balloon tip with thanks to "anon"

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

zcoder

hutch-- ,
Thats is the wrong type
we are trying to make shell icon tooltips
you know down by the clock?

Zcoder....
Back in 1979, My computer ran so fine.
And there was no such thing,
As a Microsoft Crashed Machine.
http://zcoder.110mb.com
http://www.dietzel.com/partner/idevaffiliate.php?id=345_6  Free Domain Names