![]() |
Exception EAccessViolation Form Free
** Exception EAccessViolation **
[dp][df] Hi, Bekomme o.a. Fehlermeldung (Delphi 6) weiß aber nicht warum. procedure Tfrmsaselogin.FormCreate(Sender: TObject); ... ... StartMainRptScreen(Application, SaseAdoConn, strUserId, strAccessLevel); :?: Fehlermeldung hier: If Assigned(frmsaselogin) then frmsaselogin.Free; Ich bin für jeden Vorschlag sehr Dankbar. |
Re: Exception EAccessViolation Form Free
In frmsaselogin steht ein ungültiger Wert drin. Ist dieser auch richtig initsialisiert mit nil?
Auf jeden Fall wäre bissle mehr Quellcode nicht schlecht. Für micht sieht es sehr durcheinander aus, da man nicht erkannt, was zu was gehört. |
Re: Exception EAccessViolation Form Free
Hi,
Zitat:
Also nicht so: procedure TForm1.Button1Click(Sender: TObject); begin ShowMessage('So nicht!!'); end; sondern:
Delphi-Quellcode:
MfG Marc
procedure TForm1.Button1Click(Sender: TObject);
begin ShowMessage('So ist es schöner und vor allem lesbarer!'); end; Tip: Benutze den Delphi-Code Button |
Re: Exception EAccessViolation Form Free
If the user does not have the report INI, it will prompted with a login, otherwise it will run the report automatically and (should) end the application upon completion.
Delphi-Quellcode:
procedure Tfrmsaselogin.FormCreate(Sender: TObject);
var Connstr : String; strFTPReportDIR : String; strUserId : ShortString; begin Scaleform(self); DateSeparator := '-'; ShortDateFormat := 'yyyy' + DateSeparator + 'mm' + DateSeparator + 'dd'; ThousandSeparator := '.'; DecimalSeparator := ','; try SaseAdoConn.Open except on E:Exception do begin Screen.Cursor := crDefault; SaseAdoConn := Nil; ShowMessage(E.Message); end; end; MyIniFile := TIniFile.Create('./SASE_Report.ini'); logintry:=0; logon_q.DatabaseName:= SASEDB.DatabaseName; //Check if the .ini file exists or not If FileExists('./SASE_Report.ini') then begin strFTPReportDIR := MyInifile.ReadString('FTPReportDirectory', 'FTPReportDIR', ''); If Trim(strFTPReportDIR) <> '' then begin MyInifile.Free; strUserId := 'Automatik'; strUserId:=LowerCase(strUserId); strAccessLevel := '0'; // Go straight to the Report Generator StartGenerateReports(Application,SaseAdoConn,-1, Now, Now, ''); // when the user exits the Form "StartGenerateReports" the Application should end. If Assigned(frmsaselogin) then frmsaselogin.Free; // I tried closed and Exit but the application remainded in the background end; end; // If there is no INI show the User the Login screen and let them enter their password USID_EB.Text := GetSystemUserName; end; |
Re: Exception EAccessViolation Form Free
Zitat:
(wenn es doch nötig ist, kann man die Methode Release verwenden) Du darfst ausserdem nicht in einer Methode auf eine Objektvariable der eigenen Klasse zugreifen. Du kannst aber ein Klassenfunktion schreiben, um ein Formular modal anzuzeigen:
Delphi-Quellcode:
Zum Beenden einer Anwendung benutzt man:
Tfrmsaselogin = class(TForm)
public class function ShowLoginDialog:integer; end; class function Tfrmsaselogin.ShowLoginDialog:integer; var f : Tfrmsaselogin; begin f := Tfrmsaselogin.Create(nil); try result := f.ShowModal; StartMainRptScreen(Application, SaseAdoConn, strUserId, strAccessLevel); finally f.Free; end; end;
Delphi-Quellcode:
Application.Terminate;
|
Re: Exception EAccessViolation Form Free
Danke!
Shidap :-D |
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:58 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz