29. april 2003 - 18:26Der er
15 kommentarer og 1 løsning
Hvorfor virker det her ikke??
program Project1;
uses Forms, inifiles, SysUtils, Unit1 in 'Unit1.pas' {Form1}, Unit2 in 'Unit2.pas' {Form2}, Unit3 in 'Unit3.pas' {Form3}, Unit4 in 'Unit4.pas' {Form4};
{$R *.res} function iniread(filename: string; Section: string; Name: string; defaultvalue: string):string; var ini: Tinifile; begin ini:=Tinifile.create(filename); result:=ini.readString(section,name,defaultvalue); ini.free; end; begin Application.Initialize; Application.Title := 'GameControle2'; Application.CreateForm(TForm1, Form1); Application.CreateForm(TForm2, Form2); Application.CreateForm(TForm3, Form3); Application.CreateForm(TForm4, Form4); Application.Run; If iniread(ExtractFilePath(ParamStr(0))+'gamecontrole2.ini','Generalt','SM','true')='true' then begin form1.visible := false; end else begin form1.visible := true; end; end.
Application.Run vil altid vise din main form, som er den første form der creates. Din linie med "If iniread" udføres først når der returneres fra Application.Run, dvs. når du lukker programmet ned. Med andre ord: linien "If iniread" er placeret forkert.
Sætter et breakpoint (se menuen Run eller Build - kan ikke lige huske det) og trykker F5 for at køre. Så stopper programmet der hvor break pointet er sat. Du kan lave watches, så du hele tiden kan se hvilken værdi en variabel har, og udføre programmet lignie for linie med F8 (mener jeg).
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.