RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
Exception.CreateRes Constructor (Integer)

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

Pascal
constructor CreateRes(Ident: Integer); overload;
constructor CreateRes(ResStringRec: PResStringRec); overload;
C++
__fastcall Exception(int Ident);
__fastcall Exception(PResStringRec ResStringRec);

Call CreateRes to construct an exception with a simple message string loaded from an application's resources. 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, CreateRes creates an empty message string for the exception. 

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

resourcestring sMyNewErrorMessage = 'You shouldn''t have done that';
...
Exception.Create(@sMyNewErrorMessage);

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!