Autor Beitrag
Talbot
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44

Win 2000, Win98, WinXP Prof, Linux(Suse, Gentoo, Debian, RedHat)
D6 Enterprise
BeitragVerfasst: Di 16.03.04 15:15 
Also. Ich hab folgendes Problem:
Mein Programm läuft prima, lässt sich auch beenden u.s.w aber wenn ich Windows herunter fahren will dann wird der bootdown einfach abgebrochen.

Erst wurde das Programm gar nicht beendet.
Ich habe in der Methode Form1.FormClose folgendes stehn (verkürzt):

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);

begin
      If UserAuthorized then begin
         //Werte in .ini Datei speichern
        IniDatei.Free;
      end else begin
        showmessage('Unbekannter User oder Programm wird auf anderer Maschine ausgeführt.' + #13#10 +
                    'Die ini Datei wird gelöscht und das Programm wird beendet.' + #13#10 +
                    'Neustart um neue Benutzerinformationen anzulegen.');
        IniDatei.Free;
        DeleteFile(getcurrentdir + '\EmailChecker.ini');
      end;
      Action := caFree;


end;


Erst hatte ich nur das stehen. Dabei hielt der Bootdown Vorgang nur an und das Programm lief weiter.
Jetzt hab ich nach allerhand stöbern hier im Forum noch eine Prozedur gefunden die außerdem auf die Ereignisse reagiert, welche von Windows gesendet werden:


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
 private
    procedure WMQueryEndSession (var Msg : TWMQueryEndSession); message WM_QueryEndSession;


(...)


procedure TForm1.WMQueryEndSession (var Msg : TWMQueryEndSession);
begin

      Msg.Result := 1;
      Form1.Close;

end;


Mit dieser Prozedur wird das Programm zwar beendet, aber das Runterfahren wird dennoch nicht fortgesetzt... :(

Irgendeine Idee?

Moderiert von user profile iconMotzi: Code- durch Delphi-Tags ersetzt.
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Di 16.03.04 15:42 
Hallo!

Ich denke mal, daß das ShowMessage dran schuld ist. Sorge einfach dafür, daß beim Runterfahren in FormClose kein Dialog aufgeblendet wird. Einfach mit irgendeiner Boolean-Variable merken.

Cu,
Udontknow
Talbot Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44

Win 2000, Win98, WinXP Prof, Linux(Suse, Gentoo, Debian, RedHat)
D6 Enterprise
BeitragVerfasst: Di 16.03.04 15:50 
Glaube nicht das es die showmessage ist. Denn die wird nur angezeigt wenn irgendjemand an der ini datei rumgefummelt hat. Dann wird das Programm gleich beim start beendet.
Aber ich nehms mal raus zum Test.


[Update]

Immer noch das gleiche Problem.
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Di 16.03.04 20:08 
Hast du vielleicht sowas wie MessageDlg auch in der CloseQuery drin? Da darf es auch nicht angezeigt werden.

Cu,
Udontknow
Talbot Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44

Win 2000, Win98, WinXP Prof, Linux(Suse, Gentoo, Debian, RedHat)
D6 Enterprise
BeitragVerfasst: Mi 17.03.04 07:52 
Nope... die closequery gibts gar nicht.
Talbot Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44

Win 2000, Win98, WinXP Prof, Linux(Suse, Gentoo, Debian, RedHat)
D6 Enterprise
BeitragVerfasst: Mi 17.03.04 11:08 
Hab durch aufmerksames stöbern hier im Forum gefunden das die "cooltrayicon" Komponente, welche ich auch in meinem Programm verwende dieses Problem anscheinend verursacht. Ich werd mich mal auf die Suche machen obs schon ne Lösung für dieses Problem gibt. Falls wer was weiss, bitte Laut geben :D
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Mi 17.03.04 12:09 
Ich verwende die TrayIcon-Komponente aus der JVCL. Bei der ist das zumindest nicht so.

Cu,
Udontknow
Talbot Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44

Win 2000, Win98, WinXP Prof, Linux(Suse, Gentoo, Debian, RedHat)
D6 Enterprise
BeitragVerfasst: Mi 17.03.04 13:31 
Ich hab die Cooltraykomponente grade komplett rausgeschmissen und dann gings immer noch nicht :(

Mal schaun
ich hau mal nach und nach alle Komponenten raus und schau mal an welcher es liegt...


... ich bin dadurch weitergekommen
Ich weiss das es die NMPop3 komponente ist die das Beenden aufhält.
Jetz werd ich da mal ein bisschen weiter dran rumbasteln.