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.
Project: Console Application Runner Classes
Unit: PJConsoleApp
Classes: TPJCustomConsoleApp, TPJConsoleApp
Applies to: ~>3.0
property ThreadAttrs: PSecurityAttributes;
ThreadAttrs specifies the security and inheritance attributes for the console application’s primary thread. It determines whether the thread handle can be inherited by child processes. Leaving the property as nil means the thread 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.
To make the primary thread 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.ThreadAttrs := @Attrs;
...
finally
App.Free;
end;
end;
The property is public in TPJConsoleApp and protected in TPJCustomConsoleApp.