Davide Manca
--
Davide Manca
Assistant Professor
Dipartimento di Chimica Industriale ed Ingegneria Chimica
POLITECNICO DI MILANO - ITALY
davide...@polimi.it
The uCallbackMessage of NOTIFYICONDATA is not a callback function but a
callback message.
You have to put a message id (WM_USER+XXXX or, better, a message registered
with RegisterWindowMessage) in uCallbackMessage and give a valid HWND in
hWnd member to have the message sent to your window each time the user moves
the mouse inside your system tray icon.
In wparam you will receive the icon ID (uID field of NOTIFYICONDATA) and in
lparam the mouse action performed by the user
(WM_MOUSEMOVE,WM_LBUTTONDBLCLK,WM_RBUTTONUP... and other mouse messages).
If you need to show a popup menu (as many system tray icons do) you can to
use current mouse coordinates (GetCursorPos) because there is no way (or I
don't find any) to find icons position.
---
Valter Minute
min...@fortech.it (the reply address is invalid to avoid Spam-mail)
www.fortech.it/english
---
Are you looking for a good freeware ScreenSaver? Try FOYD!
http://gsanet.com/ntfiles/cmdl/download.cmdl?catagory=ScreenS&bbsfile=foyd11
.zip&ftppath=/pub/screens/
And ask me for the source code.
For example:
case MYWM_NOTIFYICON:
switch (lParam) {
case WM_RBUTTONUP:
The best example I have seen of using it from C is in the samples area of
the CD
samples\sdk\win32\traynot
If you are using VB5 tray
http://premium.microsoft.com/support/kb/articles/q176/0/85.asp if you can.
good luck
Davide Manca <dav...@ipmch8.chin.polimi.it> wrote in article
<01bd1c42$51edcc40$5b1baf83@davidepro200>...
> I was not able to find the form prototype of the callback function
> for the Shell_NotifyIcon Win32 function which is required in the
> NOTIFYICONDATA structure definition.
> I want to the advised by Windows when the user passes with the mouse on
> the small icon I have created in the taskbar region.
> Any help appreciated,
>
Add related declares and constant and a form (you don't need to show it)
..
..
..
Dim myStruct as NOTIFYICONDATA
With myStruct
.cbSize = Len(myStruct)
.uID = vbNull
.uFlags = NIF_MESSAGE Or NIF_TIP Or NIF_ICON
.hIcon = Form1.Icon
.szTip = "Custom Tooltip" & Chr$(0)
.hwnd = Form1.hwnd
.uCallbackMessage = WM_MOUSEMOVE
End With
ShellNotifyIcon NIM_ADD, muShNotify
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single,
Y As Single)
Select Case X
Case 7770: Debug.Print "Right DblClick"
Case 7680: Debug.Print "MouseMove"
Case 7725: Debug.Print "Left DblClick"
Case 7695: Debug.Print "Left MouseDown"
Case 7755: Debug.Print "Right MouseUp"
Case 7710: Debug.Print "Left MouseUp"
Case 7740: Debug.Print "Right MouseDown"
End Select
End Sub
Bye!
Corrado
Davide Manca ha scritto nel messaggio
don´t forget to call DestroyIcon(..) after ShellNotifyIcon whenever you load
a new Icon into the system tray (e.g. to indicate different states).
Otherwise the system hangs later, because all memory is eaten up...
R.