This code is to reset the systray icon after explorer closes or crashes if you use a systray icon l
This code is to reset the systray icon after explorer closes or crashes if you use a systray icon like most devloupers and find that you cant
API Declarations
Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim SystemTrayhWnd As Long
Rate This code is to reset the systray icon after explorer closes or crashes if you use a systray icon l
(1(1 Vote))
'ok here is a simple way to fix this
'Use an api call such as send message
'Get the system tray handle
'Check to see if the handle has changed
'Reapply the icon if it has
'temporally store the new handle to repeat the process
'The code in VB6
Public Function getsystrayhwnd()
Dim shelltraywnd As Long
Dim traynotifywnd As Long
Dim trayclockwclass As Long
shelltraywnd = FindWindow("shell_traywnd", vbNullString)
traynotifywnd = FindWindowEx(shelltraywnd, 0&, "traynotifywnd", vbNullString)
trayclockwclass = FindWindowEx(traynotifywnd, 0&, "trayclockwclass", vbNullString)
If trayclockwclass = 0 Then
Exit Function
End If
If Not trayclockwclass = SystemTrayhWnd Then
SystemTrayhWnd = trayclockwclass
'call function to show icon
End If
End Function
'call this from a timer set for 5 seconds or some other event firing check
Vb code is all i know how to write this in
This code is to reset the systray icon after explorer closes or crashes if you use a systray icon l Comments
No comments yet — be the first to post one!
Post a Comment