Kill a running program

zhaozj2021-02-11  151

Procedure KillProgram (ClassName: String; WindowTitle: String);

Const

Process_terminate = $ 0001;

VAR

PROCESSHANDLE: THANDLE;

ProcessID: integer;

Thewindow: hwnd;

Begin

TheWindow: = FindWindow (Classname, WindowTertle);

GetWindowThreadProcessid (theWindow, @ProcessID);

ProcessHandle: = OpenProcess (Process_Terminate, False, ProcessID);

TerminateProcess (ProcessHandle, 4);

END;

转载请注明原文地址:https://www.9cbs.com/read-5821.html

New Post(0)