System.SysUtils.Exception.CreateResFmtHelp

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

constructor CreateResFmtHelp(ResStringRec: PResStringRec; const Args: array of const;
AHelpContext: Integer); {$IFNDEF NEXTGEN} overload; {$ENDIF !NEXTGEN}
constructor CreateResFmtHelp(Ident: NativeUInt; const Args: array of const;
AHelpContext: Integer); overload;

Properties

Type Visibility Source Unit Parent
constructor public System.SysUtils.pas System.SysUtils Exception

Description

Creates an instance of an exception with a help-context ID and a formatted message string loaded from the application resources.

Call CreateResFmtHelp to construct an exception with a:

  1. Message string loaded from an application's resources and formatted with additional information.
  2. Help-context ID.

Resources are bound into the application executable at compile time, but at design time they exist in a separate resource file. Ident is the unique ID of the resource as specified in the resource file. If Ident is not a valid resource ID, CreateResFmt creates an empty message string.

ResStringRec is a pointer to a resource string. This syntax appears as follows:



resourcestring sMyNewErrorMessage = 'Illegal value: %s';
const IDH_MYNEWERROR: Integer = 30000;
...
Exception.CreateResFmt(@sMyNewErrorMessage, [-1], IDH_MYNEWERROR);



Args is an array of constants containing values to:

1Format according to format specifiers embedded in the string, and

2Insert into the message string.

CreateResFmtHelp calls the Format function to transform the message string with the values in Arg.

AHelpContext is an integer that specifies the context-sensitive help ID for the exception.

See Also