Autor Beitrag
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: So 29.07.07 23:43 
Hallo zur späten Stunden,
ich verwende einen SplashScreen als LogIn, auf diesem sich auch ein Button zum Abbrechen des ganzen befindet.
Die Frage ist nun: Wie beende ich nun die Application ?
Die Projekt Datei schaut so aus:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
program pBTM;

uses
  Forms,
  SysUtils,
  Main in 'Main.pas' {BTM},
  SplashScreen in 'SplashScreen.pas' {SplashScreenForm};

{$R *.res}

begin
  SplashScreenForm := TSplashScreenForm.Create(Application);

  try
    SplashScreenForm.Show;
    SplashScreenForm.Update;

     // Solange der LogIn nicht erfolgreich halte das Fenster offen
    While not (Access) do Application.HandleMessage;

    Application.Initialize;
    Application.CreateForm(TBTM, BTM);

    SplashScreenForm.Hide;
  finally
    SplashScreenForm.Free;
  end;

  Application.Run;
end.



Die Prozedur, um die Applikation zu schließen, soll sich im OnClick-Event des SchließenButtons auf dem SplashScreen befinden.
Bei Application.Termaniate; macht er nichts!
Bei Destroy kommt eine AV und den SplashScreen zu schließen bringt logierscherweiße auch nicht viel. ;)


€: Access ist eine Variable vom Typ Boolean, die True wird, sobald der Login erfolgreich war.
€2: Alt+F4 verschwindet das Programm aus der Taskleiste, aber bleibt als Prozess im TaskManager weiterhin bestehen.

Also wie nun?:)
grüße


Zuletzt bearbeitet von Marc. am Mo 30.07.07 00:34, insgesamt 1-mal bearbeitet
freak4fun
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Mo 30.07.07 00:06 
Sowas?
Einloggen, um Attachments anzusehen!
_________________
"Ich werde auf GAR KEINEN Fall…!" - "Keks?" - "Okay, ich tu's."
i++; // zaehler i um 1 erhoehen
freak4fun
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Mo 30.07.07 01:17 
Hast ne PN. ;)

_________________
"Ich werde auf GAR KEINEN Fall…!" - "Keks?" - "Okay, ich tu's."
i++; // zaehler i um 1 erhoehen
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Mo 30.07.07 07:10 
Dein Login muss einfach nur drei Zustände liefern:
  • Login ok
  • Login nicht ok
  • Abbruch durch benutzer

derzeit sind es nur zwei: True und False..

_________________
Na denn, dann. Bis dann, denn.
Marc. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Mo 30.07.07 14:37 
Alles klar, ich hab das Problem nun mit ModalResult gelöst. Vielen danke nochmal an euch beiden, vor allem an user profile iconfreak4fun. ;)
Hier noch einmal der Finale Code:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
begin
  // SplashScreen Fenster erstellen
  SplashScreenForm := TSplashScreenForm.Create(Application);

  try
    // SplashScreen Fenster anzeigen
    SplashScreenForm.ShowModal;

    case SplashScreenForm.ModalResult of
       mrOk: begin
                Application.Initialize;
                Application.CreateForm(TBTM, BTM);
                Application.Run;
             end;
       mrAbort: MessageDlg('Sie haben alle 3 Versuche verbraucht!', mtError, [mbOk], 0);
    end;

  finally
    SplashScreenForm.Free;
  end;
end.

grüße
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Mo 30.07.07 15:37 
Eine Kleinigkeit: Ich finde, die Logik (Case of ...) gehört in das Modul der 'Splashform' (welches zudem ein Logindialog ist). Ich würde es so machen

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
Begin
  Application.Initialize;
  If LoginDialogModule.LoginCorrect Then Begin
    Application.CreateForm (TMainForm, MainForm);
    Application.Run;
  End
End.

_________________
Na denn, dann. Bis dann, denn.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 30.07.07 16:19 
Moin!

Ich stimme user profile iconalzaimar hier voll zu, da es dieses Problem behebt: :?
user profile iconMarc. hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
begin
  // SplashScreen Fenster erstellen
  SplashScreenForm := TSplashScreenForm.Create(Application);

  try
    // SplashScreen Fenster anzeigen
    SplashScreenForm.ShowModal;

    case SplashScreenForm.ModalResult of
       mrOk: begin
                Application.Initialize;
                Application.CreateForm(TBTM, BTM);
//...
end.

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.