Autor Beitrag
MCQ
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75

Windows 95/98/XP
Delphi 7 Etp.
BeitragVerfasst: Mi 28.01.04 18:10 
Ich hab die Aufgabe für ein Computer-Kabinett meiner Schule ein kleines Remote-Control-Programm zu schreiben. Das Programm läuft auch soweit, allerdings können die PC's (zummindest unter Win95) nicht mehr herrunter gefahren werden, wärend die Server-Anwendung läuft.

1.) Woran kann das liegen ?
2.) Wie kann ich das ändern ?

 
tomtom62
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278

WIN 2000, XP prof
D5 prof.
BeitragVerfasst: Mi 28.01.04 18:24 
Das liegt daran, dass Deine Anwendung nicht auf das Windowsende reagiert und sich selbst beendet.

Such mal nach "Herunterfahren" oder "Shutdown" hier im Forum, so was wurde hier schon öfter angesprochen.. :wink:
MCQ Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75

Windows 95/98/XP
Delphi 7 Etp.
BeitragVerfasst: Mi 28.01.04 18:59 
Hab schon gesucht bevor ich das hier gepostet hab. Ich bekomme auch eine ganze latte an Ergebnissen, die sich aber alle auf die Frage beziehen
Zitat:
"Wie lasse ich mein Programm Windows beenden?"
Aber das war ja nicht meine Frage
tomtom62
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278

WIN 2000, XP prof
D5 prof.
BeitragVerfasst: Mi 28.01.04 19:13 
Eine Variante

www.swissdelphicente.../showcode.php?id=939

Als Text:

Windows sendet die WM_QUERYENDSESSION Nachricht an alle laufenden Anwendungen
und wartet auf deren Antwort.
Wenn irgendeine Anwendungen 0 zurückgibt endet die Session nicht ansonsten
sendet Windows eine WM_ENDSESSION Nachricht an alle Anwendungen.
Jede Anwendung, die darauf mit TRUE antwortet,
kann jederzeit von Windows beendet werden.



Windows NT/2000/XP: When an application returns TRUE for this message,
it receives the WM_ENDSESSION message and it is terminated,
regardless of how the other applications respond to the WM_QUERYENDSESSION message.

Windows 95/98/Me: After all applications return TRUE for this message,
they receive the WM_ENDSESSION and they are terminated.

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

Implementation 

procedure TForm1.WMQueryEndSession (var Msg : TWMQueryEndSession); 
begin 
  if MessageDlg('Close Windows now/ Windows beenden?', 
                            mtConfirmation, 
                            [mbYes,mbNo], 0) = mrNo then 
      Msg.Result := 0 
   else 
      Msg.Result := 1; 
end;
tomtom62
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278

WIN 2000, XP prof
D5 prof.
BeitragVerfasst: Mi 28.01.04 19:17 
Modifikation zu meiner letzten Mail: Das sollte Dein Programm beenden und Windows gestatten zu beenden. (Aus dem Kopf :wink: )


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.WMQueryEndSession (var Msg : TWMQueryEndSession);  
begin  
 
      Msg.Result := 1;  

      Form1.close;

end;
MCQ Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75

Windows 95/98/XP
Delphi 7 Etp.
BeitragVerfasst: Mi 28.01.04 19:25 
Ich hatte es in ähnlicher Form probiert. Ich hatte die ApplicationEvents-Koponente genutzt und in das Event OnMessage geschrieben:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean);
begin
 if Msg.message:=WM_QUERYENDSESSION then ExitProcess(0);
end;


Kommt das nicht letztendlich auf's selbe raus ?
MCQ Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75

Windows 95/98/XP
Delphi 7 Etp.
BeitragVerfasst: Mi 28.01.04 19:31 
Noch nen kleiner Anhang zur letzt Nachricht:
Es passierte nichts. Mein Programm wurde auch nicht beendet. Komisch find ich das ja schon. :shock:
MCQ Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75

Windows 95/98/XP
Delphi 7 Etp.
BeitragVerfasst: Mi 28.01.04 19:33 
Achso es musste natürlich heiten "=" nicht ":=" das war jetzt nur nen kleiner Tippfehler
Ex0rzist
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 550

Win XP Prof.
Mandrake 10.0

D6
BeitragVerfasst: Mi 28.01.04 20:21 
Hast du vielleicht nur einfach irgendwo Form1.CanClose auf false gesetzt?

_________________
If accidentally read, induce vomitting.
MCQ Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75

Windows 95/98/XP
Delphi 7 Etp.
BeitragVerfasst: Mi 28.01.04 20:39 
Ex0rzist hat folgendes geschrieben:
Hast du vielleicht nur einfach irgendwo Form1.CanClose auf false gesetzt?


Für wie blöd hältst du mich? (!Sorry!)
Natürlich nicht !!!
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 28.01.04 21:18 
@MCQ: In dem Ton bitte nicht! Ex0rzist versucht Dir schließlich zu helfen.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Ex0rzist
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 550

Win XP Prof.
Mandrake 10.0

D6
BeitragVerfasst: Mi 28.01.04 21:37 
MCQ hat folgendes geschrieben:
Für wie blöd hältst du mich? (!Sorry!)
Natürlich nicht !!!


Das hat absolut nichts damit zu tun, für wie intelligent ich dich halte.
Manchmal übersieht man die einfachsten Sachen. Da kann man noch so schlau sein ...

P.S.: Dein Tonfall wird andere Leute nicht unbedingt anspornen, dir zu helfen.

_________________
If accidentally read, induce vomitting.
MCQ Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75

Windows 95/98/XP
Delphi 7 Etp.
BeitragVerfasst: Mi 28.01.04 22:27 
Ex0rzist hat folgendes geschrieben:
Das hat absolut nichts damit zu tun, für wie intelligent ich dich halte.
Manchmal übersieht man die einfachsten Sachen. Da kann man noch so schlau sein ...

Stimmt von der Seite hab ich das noch gar nicht gesehen. Bitte Entschuldige.

Ex0rzist hat folgendes geschrieben:
P.S.: Dein Tonfall wird andere Leute nicht unbedingt anspornen, dir zu helfen.


Hab mich ja auch gleich danach entschuldigt. Sollte nicht böse gemeint sein. Ich wusste ich hätte das *lol* doch noch dahinterschreiben sollen, damit man besser erkennt wie's gemeint war.
MCQ Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75

Windows 95/98/XP
Delphi 7 Etp.
BeitragVerfasst: Mi 28.01.04 22:30 
Peter Lustig hat folgendes geschrieben:
@MCQ: In dem Ton bitte nicht! Ex0rzist versucht Dir schließlich zu helfen.


Es tut mir leid, wenn das falsch herrüber gekommen ist. Das ist eine meiner schwächen, schriftlich meine Mimik klar zu machen. Es sollte wirklich nicht patzig rüber kommen.
MCQ Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75

Windows 95/98/XP
Delphi 7 Etp.
BeitragVerfasst: Do 29.01.04 13:07 
Ich hoffe ich hab's mir mit euch jett nicht verscherzt :(
Ex0rzist
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 550

Win XP Prof.
Mandrake 10.0

D6
BeitragVerfasst: Do 29.01.04 14:38 
Es sei dir vergeben. :wink:

Aber das ist halt das Problem mit dem Internet. Man kann das Gesicht des Anderen nicht sehen und dadurch können dann manche Sachen falsch interpretiert werden.

Zu deinem Problem: Kannst du den Rechner herunterfahren, wenn du den Serversocket deaktiverst?

_________________
If accidentally read, induce vomitting.
MCQ Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75

Windows 95/98/XP
Delphi 7 Etp.
BeitragVerfasst: Do 29.01.04 15:48 
Ich arbeite in diesem Programm nicht mit ServerSocket und ClientSocket, sondern mit der Fastnet UDP - Komponente. So richtig deaktivieren kann man die ja nicht.
G-man
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 258

Win 2000, Win ME, SuSE 8.2
D5 Standard, D6 Professional
BeitragVerfasst: Do 29.01.04 17:26 
Wie wär`s, wenn du mit einem Teil deines Quelltextes rausrücken würdest? :idea:

_________________
...To err is human, but to really foul things up requires a computer.
MCQ Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75

Windows 95/98/XP
Delphi 7 Etp.
BeitragVerfasst: Do 29.01.04 18:16 
Ich hatte diese Frage noch in nem anderen Delphi-Forum gepostet. Dort hab ich gerade Hilfe bekommen. Es hatte an der UDP-Komponente gehangen, wenn man die nutzt kann der PC nicht mehr herunterfahren. Sollte jemannd das selbe Problem haben, die Lösung findet ihr hier

Trotzdem vielen Dank für eure Hilfe.