CodeItBetter Programming Another VB Programming Blog

How to Change the visibility of the app in the taskbar at runtime

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
25
26
27
28
29
30
31
32
33
34
'System & API - How to Change the visibility of the app in the taskbar at runtime
Option Explicit
 
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, _
    ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, _
    ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, _
    ByVal nCmdShow As Long) As Long
Private Const SW_HIDE = 0
Private Const SW_SHOW = 5
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_APPWINDOW = &H40000
 
Private Sub TaskbarVisible(hWnd As Long, visible As Boolean)
    Dim wl As Long
    ShowWindow hWnd, SW_HIDE
    wl = GetWindowLong(hWnd, GWL_EXSTYLE)
    If visible = False Then
        wl = wl And Not WS_EX_APPWINDOW
    Else
        wl = wl Or WS_EX_APPWINDOW
    End If
    SetWindowLong hWnd, GWL_EXSTYLE, wl
    ShowWindow hWnd, SW_SHOW
End Sub
 
Private Sub cmdHide_Click()
    TaskbarVisible Me.hWnd, False
End Sub
 
Private Sub cmdShow_Click()
    TaskbarVisible Me.hWnd, True
End Sub

Related posts:

  1. How to Set the ShowInTaskBar Property at Runtime
  2. How to Show/Hide all Desktop Icons
  3. How to Create a Menu completely at Runtime
  4. How to disable builtin right click context menu in text box
  5. How to create form and controls dynamically
  6. How to Hide Taskbar
  7. How to Show Taskbar
  8. How to align Caption on Command Button
  9. How to uppercase the text entered in text box using API
  10. How to lowercase the text entered in text box using API

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.