ZenoTest
ZenoTest is a lightweight and powerful tool for Windows desktop UI test automation. Record, generate, and run automated tests efficiently for WPF, WinForms, and native apps.

TerminateProcess

bool TerminateProcess(int processID)

Description
Forcefully terminates a running process identified by its process ID (PID).
This function opens the process with PROCESS_TERMINATE access, calls TerminateProcess, and waits up to 5 seconds for the process to exit.
Unlike SendMessage with WM_CLOSE, this method does not require a visible window handle and works reliably with processes that have no visible top-level window, use child windows, tool windows, or render directly to the desktop.

Parameter
- processID - The process ID (PID) of the target process, typically obtained via GetProcessID().

Return
- bool - true if the process was successfully terminated, otherwise false.

Example
void main()
{
    int pid = GetProcessID("Deskora.exe");
    if (pid != 0)
    {
        bool ok = TerminateProcess(pid);
        if (ok)
            Print("Process terminated successfully");
    }
}
#include CloseAUT Console mode do...while DoubleClick Execute Fail File for GetAUTFileVersion GetAUTProductVersion GetAUTQtVersion GetAUTSuspectedCompiler GetAUTSuspectedFramework GetCurrentWorkingDir GetName GetProcessID GetProcessIDHandle GetQtProperty GetText GetValue Handle HasFocus IsAUT64Bit IsChecked IsEnabled IsVisible LeftMouseClick LeftMouseDown LeftMouseUp MiddleMouseDown MiddleMouseUp MouseWheel Pass Predefined Constants Print RightMouseClick RightMouseDown RightMouseUp Script Language SendKeys SendMessage SetFocus SetQtProperty ShellProcess Sleep StartAUT string TerminateProcess TimerStart TimerStop TimerVerifyLess vec2d VerifyContains VerifyEndsWith VerifyEqual VerifyExists VerifyGreater VerifyLess VerifyNotEqual VerifyNotExists VerifyScreenCompareEdgeBased VerifyScreenComparePixelExact VerifyStartsWith while