Ver Mensaje Individual
  #9  
Antiguo 07-12-2008
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.197
Reputación: 20
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
Cita:
Empezado por FrianxD Ver Mensaje
Bueno he encontrado bastantes cosas sobre el TiniFile pero el drama es que esta todo en delphi y yo uso C++ y no se como pasarlo si me pudieran dar una ayudita algun link q lo explique en C++ o algo me seria de mucha utilidad
Pues en mi ayuda del Builder aparece mucha información. Compotente TiniFile. No es visual por lo que se crea por código. De la misma ayuda del Builder:

Cita:
constructor and writing values in the OnClose event handler.

void __fastcall TForm1::TForm1(TObject *Sender)

{
TIniFile *ini;
ini = new TIniFile(
ChangeFileExt( Application->ExeName, ".INI" ) );
Top = ini->ReadInteger( "Form", "Top", 100 );
Left = ini->ReadInteger( "Form", "Left", 100 );
Caption = ini->ReadString( "Form", "Caption",
"Default Caption" );
ini->ReadBool( "Form", "InitMax", false ) ?
WindowState = wsMaximized :
WindowState = wsNormal;
delete ini;

}
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
TIniFile *ini;
ini = new TIniFile(ChangeFileExt( Application->ExeName, ".INI" ) );
ini->WriteInteger( "Form", "Top", Top );
ini->WriteInteger( "Form", "Left", Left );
ini->WriteString ( "Form", "Caption", Caption );
ini->WriteBool ( "Form", "InitMax",
WindowState == wsMaximized );
delete ini;
}

Each of the Read routines takes three parameters. The first parameter identifies the section of the INI file. The second parameter identifies the value you want to read, and the third is a default value in case the section or value doesn't exist in the INI file. Similarly, the Write routines will create the section and/or value if they do not exist. The example code creates an INI file the first time it is run that looks like this:
[Form]
Top=185
Left=280
Caption=Default Caption

InitMax=0
On subsequent execution of this application, the INI values are read in during creation of the form and written back out in the OnClose event.
Saludos.
Responder Con Cita