Saturday, April 3, 2010

VB6 - Menyembunyikan Dan Menampilkan Windows Taskbar

Di bawah ini merupakan contoh standar untuk menyembunyikan dan menampilkan windows taskbar menggunakan Visual Basic 6.
Option Explicit

Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Const SWP_HIDEWINDOW = &H80
Const SWP_SHOWWINDOW = &H40

Public Sub HideTaskBar()
Dim hWnd1 As Long
hWnd1 = FindWindow("Shell_traywnd", "")
Call SetWindowPos(hWnd1, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)
End Sub

Public Sub ShowTaskBar()
Dim hWnd1 As Long
hWnd1 = FindWindow("Shell_traywnd", "")
Call SetWindowPos(hWnd1, 0, 0, 0, 0, 0, SWP_SHOWWINDOW)
End Sub
Contoh penggunaan untuk menyembunyikan windows taskbar
Private Sub  Command1_Click()
HideTaskBar
End Sub
Contoh penggunaan untuk menampilkan windows taskbar
Private Sub Command2_Click()
ShowTaskBar
End Sub
Demikian mengenai cara menampilkan dan menyembunyikan windows taskbar menggunakan Visual Basic 6.