Failed to Create a Demo

2005-07-15 08:26:17 PM
After taking at look at the example form Remy's post
.... I still puzzled that why I CANNOT set a proper First Installation
date by goign through the registry at all ...
My Expriation Date setting Code canbe shown as follows:
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
TDateTime dtNow = Now();
TDateTime dtFirstRun;
TDateTime dtExpired;
TDateTime dtCountDown;
int Period = 15;
TRegistry *Reg = new TRegistry;
if( Reg->OpenKeyReadOnly("\\SOFTWARE\\Cephxxxx\\1.0\\") )
if( Reg->ValueExists("First Run") )
dtFirstRun = Reg->ReadDateTime("First Run");
dtExpired = dtFirstRun+Period;
if( dtFirstRun == (TDateTime)0 )
if( Reg->OpenKey("\\SOFTWARE\\Cephxxxx\\1.0\\", true))
Reg->WriteDateTime("First Run", dtNow);
dtExpired = dtFirstRun+Period;
Application->MessageBox(("This trial will expire on "
+DateTimeToStr(dtExpired)).c_str(), "First Run!", MB_OK);
else if( dtExpired>= dtNow )
Application->MessageBox("This trial has expired.",
Application->ShowMainForm = false;
else if( dtExpired <= dtNow )
// CountDown
dtCountDown = dtExpired - dtNow;
Application->MessageBox(("There are
"+DateTimeToStr(dtCountDown)+"Days Left before
delete Reg;
I just leave a BLANK space in string "First Run" within the registry
directory HKEY_CURRENT_USER\SOFTWARE\CephSmile\1.0\
to allow me to write the date data from function Now() into
the registry ....
I just WONDER how could I write the First Instllation data of my
program's registry .....