Hallo,<p>
ich habe eine neue Anwendung erzeugt:<p>
<pre>
DPR-Datei:<p>
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
// wird Application Run auskommentiert,
// kommt der Fehler
//
// Application.Run;
end.
<p><p>
Unit1.pas:<p>
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IniFiles;
type
TForm1 = class(TForm)
procedure FormDestroy(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormDestroy(Sender: TObject);
begin
with TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'test.ini') do
try
WriteBool('Test','Test',True);
finally
Free;
end;
end;
end.</pre>
<p>
Das Problem ist, wenn ich Application.Run nicht ausführe, also die Anwendung sofort wieder beendet wird, arbeitet WriteBool falsch, es wird anstelle 0 oder 1 einfach NICHT als Wert in die Ini eingetragen.<p>
Kann mir das jemand erklären?<p>
Schöne Grüße, Mario Noack
ich habe eine neue Anwendung erzeugt:<p>
<pre>
DPR-Datei:<p>
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
// wird Application Run auskommentiert,
// kommt der Fehler
//
// Application.Run;
end.
<p><p>
Unit1.pas:<p>
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IniFiles;
type
TForm1 = class(TForm)
procedure FormDestroy(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormDestroy(Sender: TObject);
begin
with TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'test.ini') do
try
WriteBool('Test','Test',True);
finally
Free;
end;
end;
end.</pre>
<p>
Das Problem ist, wenn ich Application.Run nicht ausführe, also die Anwendung sofort wieder beendet wird, arbeitet WriteBool falsch, es wird anstelle 0 oder 1 einfach NICHT als Wert in die Ini eingetragen.<p>
Kann mir das jemand erklären?<p>
Schöne Grüße, Mario Noack
Comment