CodeItBetter Programming Another VB Programming Blog

How to Show/Hide your SystemTray

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'System & API - How to Show/Hide your SystemTray
Option Explicit
 
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
    ByVal nCmdShow As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Long
Private 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
Private Const Tray_SHOW = 5
Private Const Tray_HIDE = 0
 
Public Sub HideSysTray(ByVal bHide As Boolean)
    Dim Trayhwnd As Long
    Trayhwnd = FindWindow("Shell_TrayWnd", "")
    Trayhwnd = FindWindowEx(Trayhwnd, 0, "TrayNotifyWnd", vbNullString)
    If bHide Then
        'To hide the System Tray
        ShowWindow Trayhwnd, Tray_HIDE   'To Hide
    Else
        'To show the System Tray
        ShowWindow Trayhwnd, Tray_SHOW  'To Show
    End If
End Sub
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.