CPB Mailing List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: INI File or Registry ?



See TRegistry in the Help VCL reference. It is fairly simple to use.
In the header file put
TRegistry * Reg;

void __fastcall TMainForm::FormCreate(TObject *Sender)
{
     Reg = new TRegistry;
     Reg->OpenKey("Software\\YourName\\YourProgram", true);
     try
     {
         Client = Reg->ReadString("Client");
          Top = Reg->ReadInteger("Top");
          Left = Reg->ReadInteger("Left");
     }
     catch(...)
     {
       /  /   key not there. do nothing
     }
}
//--------------------------------------------------------------------------
-
void __fastcall TMainAlarmForm::FormDestroy(TObject *Sender)
{
    Reg->WriteString("Client", yourclientname);
    Reg->WriteInteger("Top", Top);
    Reg->WriteInteger("Left", Left);
    Reg->Free();
}

Or you can put the line
TRegistry * Reg = new TRegistry;
in each event handler instead of adding it to the header, and add a
Reg->Free();  to the OnCreate.

-----Original Message-----
From: Roberto Luis da Costa <rcosta@perto.com.br>
To: cpb-thread@zdtips.com <cpb-thread@zdtips.com>
Date: Friday, March 06, 1998 2:54 AM
Subject: INI File or Registry ?


>
>Hi Folks,
>
>I'm writing an application wich have some initial configuration parameters,
>like client, bank account. I would like to put it in a .ini file or
registry.
>




W Komornicki's Home Page | Main Index | Thread Index