CallbackProcess

Control process start and stop operations in Windows and .NET applications

OnProcessTermination event/delegate/callback

Filter:

Pascal    C++ (Lib)    C++ (VCL)    C++ (.NET)    C#    VB.NET   

CallbackProcess     See also    

Overview

This callback is called during process termination.

Declaration

[Pascal]
    property OnProcessTermination : TProcessTerminationEvent;
    TCBProcProcessTerminationEvent = procedure( Sender : TObject; ProcessId: LongWord; ProcessName: TCBString ) of object;
    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

[C++ (Lib)]
    typedef void (*ProcessTerminationEvent)( CallbackProcess* Sender, unsigned long ProcessId, PCWSTR ProcessName );

[C++ (VCL)]
    typedef void __fastcall (__closure *TProcessTerminationEvent)( System::TObject* Sender, unsigned long ProcessId, TCBString ProcessName );

[C++ (.NET)]
    public delegate void ProcessTerminationEvent( CallbackProcess^ Sender, UInt32 ProcessId, UInt32 CreatingThreadId, String^ ProcessName );

[C#]
    delegate void ProcessTerminationEvent( CallbackProcess Sender, UInt32 ProcessId, String ProcessName );

[VB.NET]
    Delegate Sub ProcessTerminationEvent( ByVal Sender As CallbackProcess, ByVal ProcessId As UInt32, ByVal ProcessName As String )

Parameters

  • Sender - reference to the class that called the delegate/event handler
  • ProcessId - ID of the process being closed.
  • ProcessName - The name of the process identified by ProcessId parameter. The value is the same as GetProcessName(ProcessId) call would return.

Description

The callback is called at the time of process termination, just before the last thread to exit the process is destroyed. This is just a notification about termination and can not be used to cancel the termination. To prevent process termination use OnProcessHandleOperation event.

Error handling

See Error handling topic for detailed information about how to report errors, which occur in the event handlers, back to CallbackProcess.

See also

OnProcessHandleOperation     OnProcessCreation    

Back to top