Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» NewBlueFx TotalFX Windows-FL | 1.11 GB
Tue Dec 17, 2013 12:42 pm by titquarra

» NewBlueFx TotalFX Windows-FL | 1.11 GB
Tue Dec 17, 2013 12:42 pm by titquarra

» Celebrity.Sex.Tape.UNCUT.&.UNRATED.2012.720p.BRrip.x264.YIFY.mp4
Tue Dec 17, 2013 8:32 am by titquarra

» Maya Autodesk Personal Learning Edition 8.5
Tue Dec 17, 2013 7:47 am by titquarra

» Tuyệt Kỹ Đong Giai Chân Kinh (tuyệt Kỹ cua trai)
Thu Aug 23, 2012 5:38 am by Admin

» Tuyệt kỹ cua giai
Thu Aug 23, 2012 5:36 am by Admin

» NETCAT.........
Mon Aug 13, 2012 6:35 am by Admin

» Bảo mật CSDL bằng phương pháp mã hóa.
Tue Apr 17, 2012 10:04 pm by Admin

» Hàm mã hóa MD5 bằng JavaScript
Tue Apr 17, 2012 10:03 pm by Admin

Shopmotion


Affiliates
free forum


Show & Kill Processes

View previous topic View next topic Go down

Show & Kill Processes

Post  Admin on Mon Jun 13, 2011 4:22 am

Hướng dẫn viết chương trình hiển thị tất cả tiến trình đang chạy
Một số chương trình của Windows hay trojan chạy ẩn mà chúng ta không hay biết, TaskManager chỉ hiển thị một phần nào đó. Chương trình sau sẽ hiện tất cả các tiến trình đang chạy, và có thể tắt tiến trình đó nếu như ta không muốn chạy (Ví dụ Trojan chẳng hạn).

Thành phần của chương trình

- Hàm API:

Code:
Private Declare Function GetWindow Lib "user32" _
(ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetParent Lib "user32" _
(ByVal hwnd As Long) As Long
Private Declare Function GetWindowTextLength Lib _
"user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowText Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal _
lpString As String, ByVal cch As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As

String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long,

ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Const GW_HWNDFIRST = 0
Const GW_HWNDNEXT = 2

- Đối tượng

3 Command Button có thuộc tính (Name) lần lượt là cmdKillProcess, cmdRefresh, cmdQuit
1 ListBox có thuộc tính (Name) là lstTientrinh

Mã nguồn
Private Declare Function GetWindow Lib "user32" _
(ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetParent Lib "user32" _
(ByVal hwnd As Long) As Long
Private Declare Function GetWindowTextLength Lib _
"user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowText Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal _
lpString As String, ByVal cch As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As

String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long,

ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Const GW_HWNDFIRST = 0
Const GW_HWNDNEXT = 2
Dim TenTienTrinh As String
Private Sub cmdKillProcess_Click()
Dim Ret As Long
Dim hwnd As Long
On Error GoTo Refresh
hwnd = FindWindow(vbNullString, TenTienTrinh)
If hwnd <> 0 Then
Ret = PostMessage(hwnd, &H10, 0, 0)
If Ret = 0 Then
MsgBox "Khong the tat chuong trinh " & TenTienTrinh, vbExclamation, "Warning"
Else
MsgBox "Da tat chuong trinh " & TenTienTrinh, vbInformation, "Warning"
End If
End If
Refresh:
HienThiTienTrinh
End Sub

Private Sub cmdQuit_Click()
Unload Me
End Sub

Private Sub Form_Load()
HienThiTienTrinh
End Sub
Sub HienThiTienTrinh()
Dim HwndHienTai As Long
Dim Length As Long, i As Long
Dim Parent As Long
Dim TienTrinh As String

i = 0
lstTientrinh.ListItems.Clear
lstTientrinh.ColumnHeaders.Add , , "STT"
lstTientrinh.ColumnHeaders.Add , , "Processes"
lstTientrinh.ColumnHeaders.Item(1).Width = 500
lstTientrinh.ColumnHeaders.Item(2).Width = lstTientrinh.Width - 400

HwndHienTai = GetWindow(frmShowProcess.hwnd, GW_HWNDFIRST)
While HwndHienTai <> 0
Length = GetWindowTextLength(HwndHienTai)
TienTrinh = Space(Length + 1)
Length = GetWindowText(HwndHienTai, TienTrinh, Length + 1)
TienTrinh = Left(TienTrinh, Len(TienTrinh) - 1)
If Length <> 0 Then
If Me.Caption <> TienTrinh Then
If TienTrinh <> "taskmon" Then
i = i + 1
lstTientrinh.ListItems.Add(, , i).ListSubItems.Add , , TienTrinh
End If
End If
End If
HwndHienTai = GetWindow(HwndHienTai, GW_HWNDNEXT)
DoEvents
Wend
End Sub

Private Sub lstTientrinh_ItemClick(ByVal Item As MSComctlLib.ListItem)
TenTienTrinh = Item.ListSubItems(1).Text
End Sub



Admin
Admin

Tổng số bài gửi : 782
Join date : 2009-08-15

View user profile http://hackis.forumotion.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum