procedure ChangeConst ( const Constant ; var Value ; Size : Integer );
begin
Move ((@ Value )^, (@ Constant )^, Size );
end ;
// How to use ChangeConst: (Sample)
procedure TForm1 . Button1Click ( Sender : TObject );
const
TestStrConst : string = 'This is a text sample' ;
TestInteger : Integer = 4367 ;
var
NewString : string ;
NewInteger : Integer ;
begin
// String Demo:
ShowMessage ( 'Before ChangeStringConst (TestStrConst): ' + TestStrConst );
NewString := 'New Value' ;
ChangeConst ( TestStrConst , NewString , SizeOf ( string ));
ShowMessage ( 'After ChangeStringConst (TestStrConst): ' + TestStrConst );
// Integer Demo:
ShowMessage ( 'Before ChangeStringConst (TestInteger): ' + IntToStr ( TestInteger ));
NewInteger := 93534 ;
ChangeConst ( TestInteger , NewInteger , SizeOf ( Integer ));
ShowMessage ( 'After ChangeStringConst (TestInteger): ' + IntToStr ( TestInteger ));
end ;