Friday, June 8, 2012

Menonaktifkan Keyboard dan Mouse - BlockInput

Option Explicit 

Private Declare Function
BlockInput Lib "user32" (ByVal fBlock As Long) As Long

Private Sub
Command1_Click()
Timer1.Enabled = True
BlockInput True
End Sub

'Gunakan kode di bawah, agar komputer Anda tidak usah di restart
Private Sub Form_Load()
Timer1.Interval = 1000 '1 detik
Timer1.Enabled = False
End Sub

'Timer1.Interval = 1000 '1 detik
Private Sub Timer1_Timer()
Static i As Integer
i = i +
1
If i > 5 Then 'tunggu 5 detik
BlockInput False 'aktifkan kembali keyboard dan mouse
i = 0
End If
End Sub