Show / Hide Table of Contents

Class process

Process functions. Find, enumerate, get basic info, terminate, triggers, etc. Also includes properties and events of current process and thread.

public static class process

Namespace: Au
Assembly: Au.dll
Inheritance
object
process

Properties

Name Description
thisExeName

Gets file name of the program file of this process, like "name.exe".

thisExePath

Gets full path of the program file of this process.

thisProcessCultureIsInvariant

Gets or sets whether System.Globalization.CultureInfo.DefaultThreadCurrentCulture and System.Globalization.CultureInfo.DefaultThreadCurrentUICulture are System.Globalization.CultureInfo.InvariantCulture.

thisProcessHandle

Returns current process handle. See API GetCurrentProcess. Don't need to close the handle.

thisProcessId

Gets current process id. See API GetCurrentProcessId.

thisProcessSessionId

Gets user session id of this process.

thisThreadHandle

Returns native thread handle of this thread (API GetCurrentThread).

thisThreadId

Gets native thread id of this thread (API GetCurrentThreadId).

Methods

Name Description
allProcesses(bool)

Gets basic info of all processes: name, id, session id.

exists(string, bool?, bool)

Returns true if a process of the specified program is running.

getCommandLine(int, bool)

Gets the command line string used to start the specified process.

getDescription(int)

Gets description of process executable file.

getName(int, bool, bool)

Gets process executable file name (like "notepad.exe") or full path.

getProcessId(string, bool?, bool)

Gets process id of the first found process of the specified program.

getProcessIds(string, bool?, bool)

Gets process ids of all processes of the specified program.

getSessionId(int)

Gets user session id of a process (API ProcessIdToSessionId).

getTimes(int, out long, out long)

Gets process creation and execution times (API GetProcessTimes).

getVersionInfo(int)

Gets version info of process executable file.

is32Bit(int)

Returns true if the process is 32-bit, false if 64-bit. Also returns false if failed. Supports lastError.

is32Bit(nint)

Returns true if the process is 32-bit, false if 64-bit. Also returns false if failed. Supports lastError.

processIdFromHandle(nint)

Gets process id from handle (API GetProcessId).

suspend(bool, int)

Suspends or resumes the specified process.

suspend(bool, string, bool)

Suspends or resumes all processes of the specified program or programs.

terminate(int, int)

Terminates (ends) the specified process.

terminate(string, bool, int)

Terminates (ends) all processes of the specified program or programs.

thisProcessExitInvoke()

Calls and removes all process.thisProcessExit event handlers.

thisThreadHasMessageLoop()
thisThreadHasMessageLoop(out bool)

Returns true if this thread has a .NET message loop (winforms or WPF).

triggers(bool?, string, bool, int)

Provides process started/ended triggers in foreach loop. See examples.

waitForExit(Seconds, int, out int)

Waits until the process ends.

Events

Name Description
thisProcessExit

Before this process exits, either normally or on unhandled exception.

See Also

run
script
System.Diagnostics.Process