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

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

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

Call CreateResFmtHelp to construct an exception with a: 

1Message string loaded from an application's resources and formatted with additional information. 

2Help-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. 

 

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