Autor Beitrag
LonghornUser
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Mi 03.03.04 16:26 
Hallo.

Ich habe ein echtes Problem:

Ich habe mein Programm im Tray (fast immer). Wenn ich nun aber runterfahren will, geht das nicht, es passiert einfach NICHTS. warum ist das so ? Ich habe schon alle versucht. Aber nichts hat geklappt.

Was kann ich machen ? Woran könnte das liegen ? Könnte gegebenenfalls auch teile des quellcodes per mail verschicken. Aber es ist echt zum verzweifeln :(

Danke im Voraus.

Ciao LHUser
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 03.03.04 16:39 
Es ist bekannt, dass die CoolTray-Komponente an dieser Stelle einen Bug hat.
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Mi 03.03.04 16:55 
Ich nehme keine CoolTray-Komponente. Ich nehme einen Quellcode von einer Seite:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
var n:TNotifyicondata;
begin
fillchar(n,sizeof(n),0);
n.cbsize:=sizeof(n);
n.wnd:=handle;
n.uflags:=nif_MESSAGE
or nif_icon
or nif_tip;
n.ucallbackmessage:=wm_taskbarevent;
n.hicon:=application.icon.handle;
n.sztip:='Programm';
shell_notifyicon(nim_add, @n);
form1.Visible:=false;

Sollte ich vielleicht eine Komponente nehmen ? Welche Kompo nimmst du denn ?

Moderiert von user profile iconPeter Lustig: Code- durch Delphi-Tags ersetzt
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Mi 03.03.04 17:25 
Ich habe jetzt eine Kopmonente genommen für diesen Zweck (heißt DFTrayIcon von Torry). Aber das Problem besteht weiterhin.

Weiß einer eine Lösung ? Das wäre echt super.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 03.03.04 17:33 
Reagier explizit auf WM_QUERYENDSESSION und sag Windows, dass es runterfahren darf.
MaxiTB
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 679

Win2000, WinXp, Workbench ;-)
D7 Ent, VS2003 Arch.
BeitragVerfasst: Mi 03.03.04 17:35 
Wann entfernst du eigentlich das con - hier erstellst du es nur. Stichwort Suche in: Delphi-Forum, Delphi-Library NIM_DELETE.

_________________
Euer Mäxchen
Wer früher stirbt, ist länger tot.
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Mi 03.03.04 18:18 
@Luckie: Da liegt ja das Problem:

Angenommen ich schreibe rein:

ExitWindowsEx(...); // Herunterfahren

Da klappt es auch nicht, weil er nicht runterfährt, solange das Programm geöffnet ist.

@MaxiTB: Das mache ich im OnDestroy.

Weiß einer, woran das liegen könnte ?
MaxiTB
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 679

Win2000, WinXp, Workbench ;-)
D7 Ent, VS2003 Arch.
BeitragVerfasst: Mi 03.03.04 18:21 
Ich gehe jede Wette ein, daß OnDestroy wird nicht aufgerufen, weil du hart runterfährst. Dann solltest du dein Icon-Delete in eine eigene procedure auslagern und vor dem ExitWindowsEx(...) aufrufen. Obwohls eigentlich bei einem Runterfahren wurscht ist, ob dein Icon noch ein paar Sekunden sichtbar ist, aber wenns stört, probiers mal so !

_________________
Euer Mäxchen
Wer früher stirbt, ist länger tot.
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Mi 03.03.04 18:26 
Doch. Ich habe eine componente. und im destroy ereignis habe ich reingeschrieben:

dftrayicon1.active:=false;

Ich bin echt am verzweifeln :(:(

Könntest du mal einen blick drauf (auf den quellcode) werfen ? Das wäre echt super.
MaxiTB
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 679

Win2000, WinXp, Workbench ;-)
D7 Ent, VS2003 Arch.
BeitragVerfasst: Mi 03.03.04 18:32 
Kann ich nicht, weil meine mails gerade zu mir nach Hause gehen ;-). Und mein Proxy zu Hause ist eine Saugstation, da gibts keine Backdoors. *g*

Aber du brauchst doch nur das dftrayicon1.active:=false; vor das ExitWindowsEx(...) schreiben. Schon ist dein Icon weg. Oder sagen wir mal so - es ist sehr wahrscheinlich das es weg ist, weil wenn die Compo da noch Messaging durchführen will, dann wird vorher die Message Loop gekillt und es tut sich nix.

Aber ich verwende die Compo auch nicht - überhaupt keine für sowas - wozu auch ? Ist doch eh auch so ziemlich simple. Und jede Fremdkomponente macht mehr eigenartige, unwerwartete Effekte.

_________________
Euer Mäxchen
Wer früher stirbt, ist länger tot.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 03.03.04 18:32 
LonghornUser hat folgendes geschrieben:
@Luckie: Da liegt ja das Problem:

Das muss ich jetzt nicht verstehen oder? :roll: Du sollst explizit WM_QUERYENDSESSION abfragen und darauf reagieren, in dem du windows sagst es darf weiterrunterfahren.
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Mi 03.03.04 18:43 
@maxitb: Jo. Ich habe das Problem jetzt eingegrenzt:
Ich habe jetzt mal alles, was mit Tray zu tun hat gelöscht. Auch habe ich die Komponente gelöscht.
Aber es geht immernoch nicht :x Ich weiß einfach nicht warum.

Oder könnte ich das ganze mal auf einen server laden ? Ich habe einen.
MaxiTB
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 679

Win2000, WinXp, Workbench ;-)
D7 Ent, VS2003 Arch.
BeitragVerfasst: Mi 03.03.04 18:46 
Moment - hab dich da falsch verstanden - ich dachte, dein TrayIcon verschwindet nicht *g*.

Du meist wahrscheinlich, der Rechner fährt nicht runter ?

Dann poste mal den Code rund um ExitWindowsEx(...) ... da gehört ja noch eine Menge mehr dazu.

_________________
Euer Mäxchen
Wer früher stirbt, ist länger tot.
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Mi 03.03.04 18:53 
Ja,du hast recht es geht darum, dass windows nicht mehr runterfährt.
Hier der Code:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.WMQueryEndSession(var Msg: TWMQueryEndSession);
begin
    ExitWindowsEx(0,0);
    KillTask('App.exe');
end;


Aber ich verstehe nicht ganz, warum ich so etwas machen muss. Wenn ich ein Programm schribe, wo nur ein Button drauf ist, muss ich auch nicht eine solche procedure schreiben, oder ? Warum kann Windows nicht einfach normal runterfahren und das Programm von selber beenden ?

Moderiert von user profile iconPeter Lustig: Code- durch Delphi-Tags ersetzt
MaxiTB
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 679

Win2000, WinXp, Workbench ;-)
D7 Ent, VS2003 Arch.
BeitragVerfasst: Mi 03.03.04 18:59 
Die sollte eher so ausehen ...
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
private 
  procedure WMQueryEndSession (var Msg : TWMQueryEndSession); message WM_QueryEndSession; 
end; 

Implementation 

procedure TForm1.WMQueryEndSession (var Msg : TWMQueryEndSession); 
begin 
   Msg.Result := 1; 
end;


Mit dieser Funktion sagst du Windows eigentlich nur, daß deine Applikation bereit ist, beendet zu werden ...

_________________
Euer Mäxchen
Wer früher stirbt, ist länger tot.
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Mi 03.03.04 19:29 
Das hat auch nichts geholfen :(

Hast du noch irgendeine Idee ? Wäre echt supernett. Danke im Voraus.
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Mi 03.03.04 22:22 
Hallo nochmal,

Könnte ich den Quellcode mal auf meinen server laden ? Dass es sich mal jemand anguckt ? Ich weiß eht nicht mehr weiter :(
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Do 04.03.04 09:15 
Zitat:
Könnte ich den Quellcode mal auf meinen server laden ?


Wer sollte dich denn daran hindern? :wink:

Ich denke, dass das das Beste sein wird. Du könntest ihn auch posten, wenn er nicht zu lang ist. :?

_________________
Viele Grüße
Jakob
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Do 04.03.04 11:18 
Hallo!

Mißbrauchst du das Event OnCloseQuery in irgendeiner Form? Wenn du CanClose z.B. immer den Wert false zuweist, um stattdessen nur das Formular zu verstecken und das Trayicon zu zeigen, ist nix mit Runterfahren.

Cu,
Udontknow
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Do 04.03.04 14:34 
@Udontknow: Nein, ich habe keinen CanClose:=false; Befehl eingebaut. Ich finde das Problem einfach nicht.

Was könnte es sonst sein ?