To use a file. INI;
First create a file of type . ini with the example content:
[P_LOG]
command = test
Function to read file . ini:
function TForm1.LeIni(sIndice, sCampo: string): string;
var
ArqIni: TIniFile;
begin
try
Result := '';
ArqIni := TIniFile.Create(ExtractFilePath(Application.ExeName) +'Teste.ini');
try
Result := Trim(ArqIni.ReadString(sIndice, sCampo, ''));
finally
ArqIni.Free;
end;
except
ShowMessage
('Não foi possível encontrar o arquivo de Parâmetros .ini');
end;
end;
Using the function
procedure TForm1.Button3Click(Sender: TObject);
var
ConteudoArquivoINI :String;
begin
ConteudoArquivoINI := LeIni('P_LOG', 'comando')) the
end;
And if I want to give the event function through parameters set by an INI file?
– EvertonBrunoSDS
Then we’re back to square one, where you shouldn’t send String to the Event!
– Junior Moreira