COMING SOON 🚀

굿

프로세스 강제 종료

· 14년 전 · 1360
Option Explicit

Private Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Private Declare Function Process32First Lib "kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function Process32Next Lib "kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Sub CloseHandle Lib "kernel32" (ByVal hPass As Long)
Private Const TH32CS_SNAPPROCESS As Long = &H2
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
Private Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Const PROCESS_TERMINATE As Long = (&H1)
Private Declare Function TerminateProcess Lib "kernel32.dll" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)

Public Function GetPidByImage(ByVal image As String) As Long
On Local Error GoTo ErrOut:
Dim hSnapShot As Long
Dim uProcess As PROCESSENTRY32
Dim r As Long, l As Long

hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0&)
If hSnapShot = 0 Then Exit Function
uProcess.dwSize = Len(uProcess)
r = Process32First(hSnapShot, uProcess)
l = Len(image)
If l = 0 Then Exit Function
Do While r
If LCase(Left(uProcess.szExeFile, l)) = LCase(image) Then
GetPidByImage = uProcess.th32ProcessID
Exit Do
End If
r = Process32Next(hSnapShot, uProcess)
Loop
Call CloseHandle(hSnapShot)
ErrOut:
End Function

Public Sub KillPID(ByVal pid As Long)
On Local Error Resume Next
Dim h As Long
If pid = 0 Then Exit Sub
h = OpenProcess(PROCESS_TERMINATE, False, pid)
TerminateProcess h, 0
CloseHandle h
Sleep 1000
ErrOut:
End Sub<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 16:46:12 기타에서 이동 됨]</div>
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
14년 전 조회 1,552
14년 전 조회 2,032
14년 전 조회 2,165
14년 전 조회 1,366
14년 전 조회 2,609
14년 전 조회 2,598
14년 전 조회 2,171
14년 전 조회 2,135
14년 전 조회 1,650
14년 전 조회 2,136
14년 전 조회 2,031
14년 전 조회 1,769
14년 전 조회 1,451
14년 전 조회 3,213
14년 전 조회 2,524
14년 전 조회 1,883
14년 전 조회 2,529
14년 전 조회 1,402
14년 전 조회 1,521
14년 전 조회 2,141
14년 전 조회 2,225
14년 전 조회 1,841
14년 전 조회 1,527
14년 전 조회 1,702
14년 전 조회 1,650
14년 전 조회 2,469
14년 전 조회 2,604
14년 전 조회 2,480
14년 전 조회 1,609
14년 전 조회 2,190
14년 전 조회 2,216
14년 전 조회 2,307
14년 전 조회 4,110
14년 전 조회 1,639
14년 전 조회 2,464
14년 전 조회 1,378
14년 전 조회 1,508
14년 전 조회 1,364
14년 전 조회 1,801
14년 전 조회 2,236
14년 전 조회 1,781
14년 전 조회 1,630
14년 전 조회 1,309
14년 전 조회 2,286
14년 전 조회 1,871
14년 전 조회 1,394
14년 전 조회 2,805
14년 전 조회 1,901
14년 전 조회 1,835
14년 전 조회 1,361
14년 전 조회 2,240
14년 전 조회 3,202
14년 전 조회 1,597
15년 전 조회 1,057
15년 전 조회 2,589
15년 전 조회 2,327
15년 전 조회 1,270
15년 전 조회 1,849
15년 전 조회 2,021
15년 전 조회 1,858
15년 전 조회 1,228
15년 전 조회 1,216
15년 전 조회 1,526
15년 전 조회 1,831
15년 전 조회 1,691
15년 전 조회 1,375
15년 전 조회 1,797
15년 전 조회 1,630
15년 전 조회 1,912
15년 전 조회 1,377
15년 전 조회 1,624
15년 전 조회 1,415
15년 전 조회 1,759
15년 전 조회 1,242
15년 전 조회 2,641
15년 전 조회 1,844
15년 전 조회 3,423
15년 전 조회 1,815
15년 전 조회 1,573
15년 전 조회 1,629
15년 전 조회 1,625
15년 전 조회 1,079
15년 전 조회 1,350
15년 전 조회 1,406
15년 전 조회 2,856
15년 전 조회 1,486
15년 전 조회 3,858
15년 전 조회 1,335
15년 전 조회 1,158
15년 전 조회 1,237
15년 전 조회 2,227
15년 전 조회 1,830
15년 전 조회 1,647
15년 전 조회 1,698
15년 전 조회 1,615
15년 전 조회 1,731
15년 전 조회 1,383
15년 전 조회 997
15년 전 조회 1,498
15년 전 조회 2,660