ThreadCreation Event
Fires when a thread is being created.
Syntax
public event OnThreadCreationHandler OnThreadCreation; public delegate void OnThreadCreationHandler(object sender, CbprocessThreadCreationEventArgs e); public class CbprocessThreadCreationEventArgs : EventArgs { public int ProcessId { get; } public int ThreadId { get; } public int CreatingProcessId { get; } public int CreatingThreadId { get; } public int ResultCode { get; set; } }
Public Event OnThreadCreation As OnThreadCreationHandler Public Delegate Sub OnThreadCreationHandler(sender As Object, e As CbprocessThreadCreationEventArgs) Public Class CbprocessThreadCreationEventArgs Inherits EventArgs Public ReadOnly Property ProcessId As Integer Public ReadOnly Property ThreadId As Integer Public ReadOnly Property CreatingProcessId As Integer Public ReadOnly Property CreatingThreadId As Integer Public Property ResultCode As Integer End Class
Remarks
This event fires when a thread is being created, before it is started.
Applications cannot cancel thread creation; any errors returned during this event are ignored.
The ProcessId parameter reflects the Id of the process to which the new thread belongs.
The ThreadId parameter reflects the Id of the new thread.
The CreatingProcessId parameter reflects the Id of the process that created the new thread.
The CreatingThreadId parameter reflects the Id of the thread that created the new thread.
The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), set it to a non-zero value to report an appropriate error. Please refer to the Error Reporting and Handling topic for more information.
Note that the system APIs offer no way to report errors which occur during the processing of this request. Exceptional ResultCode values are therefore largely ignored.
This event is fired synchronously; please refer to the Event Types topic for more information.