نبذة عن ملفات الإيني ini. files ؟
#6
السلام عليكم
هذا شرح مختصر لطريقة استعمال ملفات INI (الشرح لـ Simon Grossenbacher ) أظنه مناسب.
PHP كود :
{
  
An INI file stores information in logical groupings, called “sections.”
  Within each section
, actual data values are stored in named keys.
  
  [
Section_Name]
  
Key_Name1=Value1
  Key_Name2
=Value2
  
}

uses
  IniFiles
;

// Write values to a INI file

procedure TForm1.Button1Click(Sender: TObject);
var
  
ini: TIniFile;
begin
  
// Create INI Object and open or create file test.ini
  
ini := TIniFile.Create('c:\MyIni.ini');
  try
    
// Write a string value to the INI file.
    
ini.WriteString('Section_Name', 'Key_Name', 'String Value');
    
// Write a integer value to the INI file.
    
ini.WriteInteger('Section_Name', 'Key_Name', 2002);
    
// Write a boolean value to the INI file.
    
ini.WriteBool('Section_Name', 'Key_Name', True);
  finally
    
ini.Free;
  
end;
end;


// Read values from an INI file

procedure TForm1.Button2Click(Sender: TObject);
var
  
ini: TIniFile;
  
res: string;
begin
  
// Create INI Object and open or create file test.ini
  
ini := TIniFile.Create('c:\MyIni.ini');
  try
    
res := ini.ReadString('Section_Name', 'Key_Name', 'default value');
    
MessageDlg('Value of Section:  ' + res, mtInformation, [mbOK], 0);
  finally
    
ini.Free;
  
end;
end;

// Read all sections

procedure TForm1.Button3Click(Sender: TObject);
var 
  
ini: TIniFile;
begin
  ListBox1
.Clear;
  
ini := TIniFile.Create('MyIni.ini');
  try
    
ini.ReadSections(listBox1.Items);
  finally 
    
ini.Free; 
  
end;
end;

// Read a section

procedure TForm1.Button4Click(Sender: TObject);
var 
  
ini: TIniFile;
begin
  ini
: = TIniFile.Create('WIN.INI');
  try
    
ini.ReadSection('Desktop', ListBox1.Items);
  finally
    
ini.Free;
  
end;
end;


// Read section values

procedure TForm1.Button5Click(Sender: TObject);
var
  
ini: TIniFile;
begin
  ini 
:= TIniFile.Create('WIN.INI');
  try
    
ini.ReadSectionValues('Desktop', ListBox1.Items);
  finally 
    
ini.Free;  
  
end;
end;

// Erase a section

procedure TForm1.Button6Click(Sender: TObject);
var 
  
ini: TIniFile;
begin
  ini 
:= TIniFile.Create('MyIni.ini');
  try
    
ini.EraseSection('My_Section');
  finally
    
ini.Free;
  
end;
end; 

أخي tf6mehboul لا تلعب بدراستك فيحدث لك مثلما حدث لي بسبب انشغالي بالدلفي عن الدراسة.
[-] كل من 1 user says قال شكرا ل kachwahed على المشاركة المفيدة
  • Rever7eR
الرد


الردود في هذا الموضوع
نبذة عن ملفات الإيني ini. files ؟ - بواسطة TF6M - 09-02-2009, 01:07 PM
نبذة عن ملفات الإيني ini. files ؟ - بواسطة TF6M - 10-02-2009, 12:45 AM
نبذة عن ملفات الإيني ini. files ؟ - بواسطة kachwahed - 10-02-2009, 03:13 PM

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم