corelibraries-devexpress-dot-data-dot-utils-dot-processstartpolicy-8ed14aed.md
Fires before a process starts and allows you to cancel the process.
Namespace : DevExpress.Data.Utils
Assembly : DevExpress.Data.Desktop.v25.2.dll
NuGet Packages : DevExpress.Data.Desktop, DevExpress.ExpressApp.Win.Design
public static event CancelEventHandler Starting
Public Shared Event Starting As CancelEventHandler
The Starting event's data class is CancelEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Cancel | Gets or sets a value indicating whether the event should be canceled. |
Handle Starting and Started events to perform custom actions when a DevExpress UI control starts a process.
static void Main() {
ProcessStartPolicy.Starting += ProcessStartPolicy_Starting;
ProcessStartPolicy.Started += ProcessStartPolicy_Started;
// ...
}
private static void ProcessStartPolicy_Starting(object sender, System.ComponentModel.CancelEventArgs e) {
ProcessStartInfo psi = sender as ProcessStartInfo;
e.Cancel = !psi.FileName.Contains("www.devexpress.com");
}
private static void ProcessStartPolicy_Started(object sender, EventArgs e) {
Process process = sender as Process;
// ...
// Log.WriteMessage("process started");
}
Shared Sub Main()
AddHandler ProcessStartPolicy.Starting, AddressOf ProcessStartPolicy_Starting
AddHandler ProcessStartPolicy.Started, AddressOf ProcessStartPolicy_Started
' ...
End Sub
Private Shared Sub ProcessStartPolicy_Starting(sender As Object, e As CancelEventArgs)
Dim psi As ProcessStartInfo = CType(sender, ProcessStartInfo)
e.Cancel = Not psi.FileName.Contains("www.devexpress.com")
End Sub
Private Shared Sub ProcessStartPolicy_Started(sender As Object, e As EventArgs)
Dim process As Process = CType(sender, Process)
' ...
' Log.WriteMessage("process started")
End Sub
Read the following topic for more information: Suppress New Processes Initiated by .NET Controls.
See Also