ZenoTest
ZenoTest — Windows Desktop UI Testautomatisierung für Qt, WPF, WinForms & native Apps. Aufzeichnen, skripten und automatisierte GUI-Tests mit CI/CD-Integration ausführen.

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");
    }
}
#define #include abs Array ceil CloseAUT Console mode do...while DoubleClick DragAndDrop Execute Fail File floor for Format GetAUTFileVersion GetAUTProductVersion GetAUTQtVersion GetAUTSuspectedCompiler GetAUTSuspectedFramework GetClipboard GetCurrentDate GetCurrentTime GetCurrentWorkingDir GetEnv GetName GetProcessID GetProcessIDHandle GetQtProperty GetText GetTimestamp GetValue Handle HasFocus IsAUT64Bit IsChecked IsEnabled IsVisible LeftMouseClick LeftMouseDown LeftMouseUp max MiddleMouseClick MiddleMouseDown MiddleMouseUp min MouseMove MouseWheel Pass pow Predefined Constants Print rand Regex RegexMatch RightMouseClick RightMouseDown RightMouseUp round Script Language SendKeys SendMessage SetClipboard SetFocus SetGlobal SetQtProperty ShellProcess Sleep sqrt srand StartAUT string TerminateProcess TimerStart TimerStop TimerVerifyLess vec2d VerifyContains VerifyEmpty VerifyEndsWith VerifyEqual VerifyExists VerifyFalse VerifyGreater VerifyGreaterEqual VerifyLess VerifyLessEqual VerifyNotEqual VerifyNotExists VerifyScreenCompareEdgeBased VerifyScreenComparePixelExact VerifyStartsWith VerifyTrue WaitForControl WaitUntilEnabled WaitUntilVisible while