RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
Exception.CreateResFmt Constructor (Integer, array of const)

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

Pascal
constructor CreateResFmt(Ident: Integer; const Args: array of const); overload;
constructor CreateResFmt(ResStringRec: PResStringRec; const Args: array of const); overload;
C++
__fastcall Exception(int Ident, const array of const Args);
__fastcall Exception(PResStringRec ResStringRec, const array of const Args);

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: 

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

2Insert into the message string. 

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

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!