System.SysUtils.Exception.CreateResFmt

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

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

Properties

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

Description

Creates an instance of an exception with a message string that is loaded from the application's resources and then formatted.

Call CreateResFmt to construct an exception with a message string loaded from an application's resources and then formatted with additional information. 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 for the exception.

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



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



Args is an array of constants containing values to:

  1. Format according to format specifiers embedded in the string.
  2. Insert into the message string.

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

See Also