Başlangıç > Kodlar > Visual Basic 6 ile Çalışan programları bulmak ve kapatmak

Visual Basic 6 ile Çalışan programları bulmak ve kapatmak


Program çalışan programların bir listesini veriyor ve istediklerinizi kapatabiliyorsunuz

Yeni bir form açın ve forma 1 ListBox ve bir CommandButton ekleyin code kısmınada aşşağıdaki yazıyı olduğu gibi kopyalayın.


Private Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal dwFlags As Long, ByVal th32ProcessID As Long) As Long
Private Declare Function Process32First Lib "kernel32" (ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long
Private Declare Function Process32Next Lib "kernel32" (ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long
Private Declare Function TerminateProcess Lib "kernel32" (ByVal ApphProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long

Private Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * 260
End Type

Dim lSnapShot As Long, lNextProcess As Long, Program As PROCESSENTRY32

Private Sub Command1_Click()
TerminateProcess OpenProcess(0, False, Val(List1.Text)), lExitCode
DoEvents
List1.Clear
Bul
End Sub

Private Sub Form_Load()
Bul
End Sub

Private Sub Bul()
lSnapShot = CreateToolhelp32Snapshot(&H2&, 0&)
Program.dwSize = Len(Program)
lNextProcess = Process32First(lSnapShot, Program)
Do While lNextProcess
List1.AddItem Program.th32ProcessID & " " & Program.szExeFile
lNextProcess = Process32Next(lSnapShot, Program)
Loop
End Sub


Özgür KARA


TD Software


  1. Henüz yorum yapılmamış.
  1. No trackbacks yet.

Yorum bırakın