Tuesday, May 29, 2012

Blokir Situs Menggunakan Visual Basic 6.0

Option Explicit 

Public Declare Function
GetForegroundWindow Lib "user32" ) As Long
Public Declare Function
SendMessage Lib "user32" Alias "SendMessageA" ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function
GetWindowText Lib "user32" Alias "GetWindowTextA" ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Const
WM_CLOSE = &H10

Public Function
kick(target As String)
Dim H As Long
Dim T As String *
255
H = GetForegroundWindow
GetWindowText H, T, 255
If InStr(UCase(T), UCase(target)) > 0 Then
SendMessage H, WM_CLOSE, 0, 0
End If
End Function