Systray

nitroptik Messages postés 50 Date d'inscription samedi 5 octobre 2002 Statut Membre Dernière intervention 13 mai 2007 - 6 mai 2007 à 13:52
cs_casy Messages postés 7741 Date d'inscription mercredi 1 septembre 2004 Statut Membre Dernière intervention 24 septembre 2014 - 6 mai 2007 à 13:58
Bonjour j'ai ce code qui fonctionne très bien sauf quand je ferme mon appli, l'icon du prog reste gelé dans le systray, je dois passer ma souris dessus pour qu'elle s'efface alors comment faire pour que l'icon s'efface toute seule ? merci

Private Sub Form_Initialize()

try.cbSize = Len(try)
try.hwnd = Me.hwnd
try.uId = vbNull
try.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
try.uCallBackMessage = WM_MOUSEMOVE
try.hIcon = Me.Icon
try.szTip = App.Title & vbNullChar

Call Shell_NotifyIcon(NIM_ADD, try)
Call Shell_NotifyIcon(NIM_MODIFY, try)

End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Select Case X
Case 7755:
PopupMenu Menu
End Select

End Sub

dans un module:

Public Type NOTIFYICONDATA
cbSize As Long
hwnd As Long
uId As Long
uFlags As Long
uCallBackMessage As Long
hIcon As Long
szTip As String * 64
End Type

Public Const NIM_ADD = &H0
Public Const NIM_MODIFY = &H1
Public Const NIM_DELETE = &H2
Public Const WM_MOUSEMOVE = &H200
Public Const NIF_MESSAGE = &H1
Public Const NIF_ICON = &H2
Public Const NIF_TIP = &H4

Public Const WM_LBUTTONDBLCLK = &H203
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONUP = &H202

Public Const WM_RBUTTONDBLCLK = &H206
Public Const WM_RBUTTONDOWN = &H204
Public Const WM_RBUTTONUP = &H205

Public Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, ptry As NOTIFYICONDATA) As Boolean
Public try As NOTIFYICONDATA

1 réponse

cs_casy Messages postés 7741 Date d'inscription mercredi 1 septembre 2004 Statut Membre Dernière intervention 24 septembre 2014 40
6 mai 2007 à 13:58
Ben disons que de la même façon ou au lancement tu utilise Shell_NotifyIcon pour ajouter l'icone dans le Systray, l'idée serait que à la fermeture, tu utilise Shell_NotifyIcon pour effecer l'icone du Systray, avant d'avoir totalement fermer l'appli, par exemple sur le Form_Unload, ou alors dans la procédure de fermeture.

Regarde la constante message NIM_DELETE, ça te donne pas une idée ?

---- Sevyc64  (alias Casy) ----<hr size="2" width="100%" /># LE PARTAGE EST NOTRE FORCE #
0
Rejoignez-nous