Skip to content

Planet-Source-Code/vf-fcro-how-to-terminate-process-by-hwnd__1-33978

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

How to Terminate Process By HWND

Description

---<<>>---@@---<<>>---

More Info

Submitted On
By VF-fCRO
Level Advanced
User Rating 5.0 (10 globes from 2 users)
Compatibility VB 6.0
Category Coding Standards
World Visual Basic
Archive File

Source Code

Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess 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 Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Sub TerminateProcByHwnd(ByVal hwnd As Long)
Const PROCESS_ALL_ACCESS = &H1F0FFF
Dim ThreadIDX As Long
Dim PROCESSIDX As Long
Dim EXCODE As Long
Dim PROCESS As Long
ThreadIDX = GetWindowThreadProcessId(hwnd, PROCESSIDX)
PROCESS = OpenProcess(PROCESS_ALL_ACCESS, 0, PROCESSIDX)
Call GetExitCodeProcess(PROCESS, EXCODE)
Call TerminateProcess(PROCESS, EXCODE)
Call CloseHandle(PROCESS)
End Sub


Terminate Calling:TerminateProcByHwnd hwnd

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published