Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

ProcessAttrs property

Project: Console Application Runner Classes

Unit: PJConsoleApp

Classes: TPJCustomConsoleApp, TPJConsoleApp

Applies to: ~>3.0

property ProcessAttrs: PSecurityAttributes;

Description

This property specifies the security and inheritance attributes for a console application process. It determines whether the process handle can be inherited by child processes. Setting ProcessAttrs to nil means the process handle can’t be inherited.

Note that the caller is responsible for setting up the structure correctly. The caller need not maintain a copy of the provided structure once the property is set since an internal copy is made.

The property’s default value is nil.

Remarks

To make the process handle inheritable set the bInheritHandle field of the TSecurityAttributes record to True. For example:

var
  App: TPJConsoleApp;
  Attrs: TSecurityAttributes;
begin
  Attrs.nLength := SizeOf(Security);
  Attrs.lpSecurityDescriptor := nil;
  Attrs.bInheritHandle := True;
  App := TPJConsoleApp.Create;
  try
    App.ProcessAttrs := @Attrs;
    ...
  finally
    App.Free;
  end;
end;

The property is public in TPJConsoleApp and protected in TPJCustomConsoleApp.