delphi的帮助实在让人无比的心寒
我在MSDN中从未见过象这么水的帮助:
he ini file format is still popular, many configuration files (such as the DSK Desktop settings file) are in this format. This format is especially useful in cross-platform applications, where you can't always count on a system Registry for storing configuration information. BaseCLX provides two classes, TIniFile and TMemIniFile, to make reading and writing ini files very easy.
TIniFile works directly with the ini file on disk while TMemIniFile buffers all changes in memory and does not write them to disk until you call the UpdateFile method.
When you instantiate the TIniFile or TMemIniFile object, you pass the name of the ini file as a parameter to the constructor. If the file does not exist, it is automatically created. You are then free to read values using the various read methods, such as ReadString, ReadDate, ReadInteger, or ReadBool. Alternatively, if you want to read an entire section of the ini file, you can use the ReadSection method. Similarly, you can write values using methods such as WriteBool, WriteInteger, WriteDate, or WriteString.
Following is an example of reading configuration information from an ini file in a form's OnCreate event handler and writing values in the OnClose event handler.
procedure TForm1.FormCreate(Sender: TObject);
var
Ini: TIniFile;
begin
Ini := TIniFile.Create( ChangeFileExt( Application.ExeName, '.INI' ) );
try
Top := Ini.ReadInteger( 'Form', 'Top', 100 );
Left := Ini.ReadInteger( 'Form', 'Left', 100 );
Caption := Ini.ReadString( 'Form', 'Caption', 'New Form' );
if Ini.ReadBool( 'Form', 'InitMax', false ) then
WindowState = wsMaximized
else
WindowState = wsNormal;
finally
TIniFile.Free;
end;
end;
基本的语法检查都欠缺