Assalamu’alaikum Wr.Wb
Pagi semua.... Kali ni aq mau share tentang
pembuatan Task Manager.. Tahu kan Task Manager itu apa, msak gak tahu sih..
kalau belum tahu silahkan tanya mbah google aja... (^_^) . Tapi ingat ni buat
pengetahuan aj.. jangan di salah gunain ya.. (^_^) . Langsung aja ya..
-
Seperti
biasa buka Visual Basic pilih standard.Exe
-
-
Kemudian
tambahkan 2 label, 1 listbox, 3 command Button, 2 Checklist, 1 module dengan
nama MODApi
Buat Propertiesnya :
Form1
BorderStyle : None
Label1 (Cuma buat judul aplikasi)
Caption : Task Manager
Label2
Caption : X
Command1
Name : cmdEndTsk
Capyion : End Task
Coomand2
Name : cmdRefresh
Caption : Refresh
Command3
Name : cmdToogle
Caption : Toogle
CheckList1
Name : chk1
Caption : Window terlihat
CheckList2
Name : chk2
Caption : Window Tersembunyi
Kurang lebih ya seperti
ini..
Buat modulnya scriptnya
seperti berikut :
Option Explicit
Public Const SW_HIDE = 0
Public Const SW_SHOW = 5
Public Declare Function
FindWindowEx Lib "user32" Alias "FindWindowExA" _
( _
ByVal hWnd1 As Long, _
ByVal hWnd2 As Long, _
ByVal lpsz1 As String, _
ByVal lpsz2 As String _
) 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 Declare Function
lstrlen Lib "kernel32" _
Alias "lstrlenA" _
( _
ByVal lpString As String _
) As Long
Public Declare Function
GetClassName Lib "user32" _
Alias
"GetClassNameA" _
( _
ByVal hwnd As Long, _
ByVal lpClassName As String, _
ByVal nMaxCount As Long) 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
IsWindowVisible Lib "user32" _
( _
ByVal hwnd As Long _
) As Long
Public Declare Function
ShowWindow Lib "user32" _
( _
ByVal hwnd As Long, _
ByVal nCmdShow As Long _
) As Long
------------------------------------------------------------------------------------------------------------------------------------------
Kemudian masukkan script
berikut di form1,
------------------------------------------------------------------------------------------------------------------------------------------
Option Explicit
Dim hWndTGT As Long
Private Sub
cmdEndTsk_Click()
If hWndTGT = 0 Then Exit Sub
SendMessage hWndTGT,
&H112, &HF060, 0
End Sub
Private Sub
cmdRefresh_Click()
Dim hWndx As Long
Dim lpStr As String * 255
Dim cnt As Integer
Dim lpClassName As String *
255
List1.Clear
hWndx = FindWindowEx(0, 0,
vbNullString, vbNullString)
Do
GetWindowText hWndx&,
lpStr, 255
GetClassName hWndx&,
lpClassName$, 255
If chk1.Value And chk2.Value
Then
GoTo IsiData
ElseIf chk1.Value Then
If IsWindowVisible(hWndx)
Then
GoTo IsiData
End If
ElseIf chk2.Value Then
If Not
IsWindowVisible(hWndx) Then
GoTo IsiData
End If
End If
Ulangi:
hWndx = FindWindowEx(0,
hWndx, vbNullString, vbNullString)
DoEvents
Loop While hWndx > 0
Exit Sub
IsiData:
cnt = List1.ListCount
List1.AddItem Left$(lpStr,
lstrlen(lpStr)) + " (" + _
Left$(lpClassName,
lstrlen(lpClassName)) + ")"
List1.ItemData(cnt) = hWndx
GoTo Ulangi
End Sub
Private Sub cmdToggle_Click()
If IsWindowVisible(hWndTGT)
Then
ShowWindow hWndTGT, SW_HIDE
Else 'bila tersembunyi maka
ShowWindow hWndTGT, SW_SHOW
End If
End Sub
Private Sub Label2_Click()
End
End Sub
Private Sub List1_Click()
hWndTGT =
List1.ItemData(List1.ListIndex)
End Sub
Setelah selesai silahkan
tekan F5, kalau gak mau ribet silahkan download di sini aj sourcenya..
Selamat Mencoba..
Semoga Bermanfaat..
Wassalamu’alaikum Wr.Wb
ConversionConversion EmoticonEmoticon