Okelah kalau begitu saya akan lanjutkan tentang coding nya bagi yang tertarik silakan ikuti langkah - langkah berikut ...
- Tambahkan tiga buah CommandButton diproject, masing-masing dengan nama : cmdTaskbar, cmdStartButton dan cmdSystemClock
- Tambahkan satu buah Module
' Tempatkan Coding dibawah ini pada Module
Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetDlgItem Lib "user32" (ByVal hDlg As Long, ByVal nIDDlgItem As Long) As Long
Public TaskBarStyle As Boolean, StartButtonStyle As Boolean, SystemClockStyle As Boolean
Public Const StartButtonID = &H130
Public Const SystemClockID = &H12F
Public Const SW_HIDE = 0
Public Const SW_SHOW = 5
Public Sub HideTaskBar()
Dim wClassName As String
Dim hwndTaskbar As Long
wClassName = "Shell_TrayWnd"
hwndTaskbar = FindWindow(wClassName, vbNullString)
If TaskBarStyle = False Then
Form1.cmdTaskbar.Caption = "Show Taskbar"
ShowWindow hwndTaskbar, SW_HIDE
TaskBarStyle = True
Else
Form1.cmdTaskbar.Caption = "Hide Taskbar"
ShowWindow hwndTaskbar, SW_SHOW
TaskBarStyle = False
End If
End Sub
Public Sub HideStartButton()
Dim wClassName As String
Dim hwndTaskbar As Long, hwndStartbutton As Long
wClassName = "Shell_TrayWnd"
hwndTaskbar = FindWindow(wClassName, vbNullString)
hwndStartbutton = GetDlgItem(hwndTaskbar, StartButtonID)
If StartButtonStyle = False Then
Form1.cmdStartButton.Caption = "Show Start Button"
ShowWindow hwndStartbutton, SW_HIDE
StartButtonStyle = True
Else
Form1.cmdStartButton.Caption = "Hide Start Button"
ShowWindow hwndStartbutton, SW_SHOW
StartButtonStyle = False
End If
End Sub
Public Sub HideSystemClock()
Dim wClassName As String
Dim hwndTaskbar As Long, hwndSystemClock As Long
wClassName = "Shell_TrayWnd"
hwndTaskbar = FindWindow(wClassName, vbNullString)
hwndSystemClock = GetDlgItem(GetDlgItem(hwndTaskbar, SystemClockID), SystemClockID)
If SystemClockStyle = False Then
Form1.cmdSystemClock.Caption = "Show System Colock"
ShowWindow hwndSystemClock, SW_HIDE
SystemClockStyle = True
Else
Form1.cmdSystemClock.Caption = "Hide System Clock"
ShowWindow hwndSystemClock, 5
SystemClockStyle = False
End If
End Sub
Public Sub SetToDefault()
TaskBarStyle = True
StartButtonStyle = True
SystemClockStyle = True
HideTaskBar
HideStartButton
HideSystemClock
End Sub
Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetDlgItem Lib "user32" (ByVal hDlg As Long, ByVal nIDDlgItem As Long) As Long
Public TaskBarStyle As Boolean, StartButtonStyle As Boolean, SystemClockStyle As Boolean
Public Const StartButtonID = &H130
Public Const SystemClockID = &H12F
Public Const SW_HIDE = 0
Public Const SW_SHOW = 5
Public Sub HideTaskBar()
Dim wClassName As String
Dim hwndTaskbar As Long
wClassName = "Shell_TrayWnd"
hwndTaskbar = FindWindow(wClassName, vbNullString)
If TaskBarStyle = False Then
Form1.cmdTaskbar.Caption = "Show Taskbar"
ShowWindow hwndTaskbar, SW_HIDE
TaskBarStyle = True
Else
Form1.cmdTaskbar.Caption = "Hide Taskbar"
ShowWindow hwndTaskbar, SW_SHOW
TaskBarStyle = False
End If
End Sub
Public Sub HideStartButton()
Dim wClassName As String
Dim hwndTaskbar As Long, hwndStartbutton As Long
wClassName = "Shell_TrayWnd"
hwndTaskbar = FindWindow(wClassName, vbNullString)
hwndStartbutton = GetDlgItem(hwndTaskbar, StartButtonID)
If StartButtonStyle = False Then
Form1.cmdStartButton.Caption = "Show Start Button"
ShowWindow hwndStartbutton, SW_HIDE
StartButtonStyle = True
Else
Form1.cmdStartButton.Caption = "Hide Start Button"
ShowWindow hwndStartbutton, SW_SHOW
StartButtonStyle = False
End If
End Sub
Public Sub HideSystemClock()
Dim wClassName As String
Dim hwndTaskbar As Long, hwndSystemClock As Long
wClassName = "Shell_TrayWnd"
hwndTaskbar = FindWindow(wClassName, vbNullString)
hwndSystemClock = GetDlgItem(GetDlgItem(hwndTaskbar, SystemClockID), SystemClockID)
If SystemClockStyle = False Then
Form1.cmdSystemClock.Caption = "Show System Colock"
ShowWindow hwndSystemClock, SW_HIDE
SystemClockStyle = True
Else
Form1.cmdSystemClock.Caption = "Hide System Clock"
ShowWindow hwndSystemClock, 5
SystemClockStyle = False
End If
End Sub
Public Sub SetToDefault()
TaskBarStyle = True
StartButtonStyle = True
SystemClockStyle = True
HideTaskBar
HideStartButton
HideSystemClock
End Sub
' Tempatkan Coding dibawah ini pada Form Project
Private Sub cmdStartButton_Click()
HideStartButton
End Sub
Private Sub cmdSystemClock_Click()
HideSystemClock
End Sub
Private Sub cmdTaskbar_Click()
HideTaskBar
End Sub
Private Sub Form_Load()
cmdTaskbar.Caption = "Hide TaskBar"
cmdStartButton.Caption = "Hide Start Button"
cmdSystemClock.Caption = "Hide System Clock"
End Sub
Private Sub Form_Unload(Cancel As Integer)
SetToDefault
End Sub
Private Sub cmdStartButton_Click()
HideStartButton
End Sub
Private Sub cmdSystemClock_Click()
HideSystemClock
End Sub
Private Sub cmdTaskbar_Click()
HideTaskBar
End Sub
Private Sub Form_Load()
cmdTaskbar.Caption = "Hide TaskBar"
cmdStartButton.Caption = "Hide Start Button"
cmdSystemClock.Caption = "Hide System Clock"
End Sub
Private Sub Form_Unload(Cancel As Integer)
SetToDefault
End Sub
Mudah - mudahan Tips ini ada mamfaat nya bagi kita semua dan VB Developer khususnya, semoga tidak digunakan untuk menjahili teman atau orang lain. Kalau ada kesempatan dan waktu kita akan ketemu dengan Tips - Trik berikutnya .. terima kasih.
0 komentar:
Posting Komentar