Delphi-PRAXiS
Seite 6 von 7   « Erste     456 7      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Windows XP beenden (https://www.delphipraxis.net/13733-windows-xp-beenden.html)

Luckie 28. Jan 2005 09:46

Re: Windows XP beenden
 
Delphi-Quellcode:
ExitWin(EWX_REBOOT or EWX_FORCE);

emsländer 28. Jan 2005 09:50

Re: Windows XP beenden
 
Zitat:

Zitat von Luckie
Delphi-Quellcode:
ExitWin(EWX_REBOOT or EWX_FORCE);

Hallo Michael,

:wall: da soll mal einer drauf kommen, das man anstelle von EWX_REBOOT dann EWX_FORCE reinschreiben soll ....

Klappt diese Funktion auch als Dienst?

Gruss

Jörg

Luckie 28. Jan 2005 10:36

Re: Windows XP beenden
 
Sollte eigentlich. Probier es aus.

emsländer 28. Jan 2005 15:12

Re: Windows XP beenden
 
Zitat:

Zitat von Luckie
Sollte eigentlich. Probier es aus.

Hallo Michael,

leider ist es das nicht:

ExitWin(EWX_FORCE); - macht gar nix --
ExitWin(EWX_REBOOT); - rebootet -- // Ohne Force

muss man vielleicht in der Routine: ExitWin(flag:word)

an der Stelle:

result := ExitWindowsEx(flag,0); - anstelle der "0" das EWX_REBOOT rein?



Gruss

EL

Luckie 28. Jan 2005 16:22

Re: Windows XP beenden
 
Logisch das EWX_FORCE nicts macht, es ist ja ein zusätzliches Flag, deswegen habe ich es ja auch mit or mit einem Flag verknüpft, dass was "mcht". Siehe mein Beispiel.

Link ins MSDN: MSDN-Library durchsuchenExitWindowsEx.

emsländer 28. Jan 2005 16:50

Re: Windows XP beenden
 
Zitat:

Zitat von Luckie
Logisch das EWX_FORCE nicts macht, es ist ja ein zusätzliches Flag, deswegen habe ich es ja auch mit or mit einem Flag verknüpft, dass was "mcht". Siehe mein Beispiel.

Link ins MSDN: MSDN-Library durchsuchenExitWindowsEx.

Ich hab in die Routine das EWX_FORCE als zweites Flag mit reingebastelt. Und siehe da... es funzt.

Falls jemand einen Dienst benötigt, der einen Einwahlserver überwacht und notfalls selbstständig bootet, stelle ich dieses Teil gern für die Codelib zur Verfügung. (ist übrigens in D2005)


Danke nochmal

Gruss

EL

Luckie 28. Jan 2005 16:57

Re: Windows XP beenden
 
Zitat:

Zitat von emsländer
Ich hab in die Routine das EWX_FORCE als zweites Flag mit reingebastelt. Und siehe da... es funzt.

Was verstehst du unter "reingebastelt"? Meine Version mit der or Verknüpfung sollte es tun.

emsländer 28. Jan 2005 17:01

Re: Windows XP beenden
 
Zitat:

Zitat von Luckie
Zitat:

Zitat von emsländer
Ich hab in die Routine das EWX_FORCE als zweites Flag mit reingebastelt. Und siehe da... es funzt.

Was verstehst du unter "reingebastelt"? Meine Version mit der or Verknüpfung sollte es tun.


ich habe in die Funktion:

function ExitWin(flag:word): Boolean;

den Aufruf:

result := ExitWindowsEx(flag,0);

verändert:

result := ExitWindowsEx(flag,EWX_FORCE);


Gruss

EL

Luckie 28. Jan 2005 17:07

Re: Windows XP beenden
 
Das kann nicht sein:
Zitat:

Code:
BOOL ExitWindowsEx(
  UINT uFlags,
  DWORD dwReason
);

Zitat:

dwReason
[in] Reason for initiating the shutdown. This parameter must be one of the system shutdown reason codes.
If this parameter is zero, the SHTDN_REASON_FLAG_PLANNED reason code will not be set and therefore the default action is an undefined shutdown that is logged as "No title for this reason could be found". By default, it is also an unplanned shutdown. Depending on how the system is configured, an unplanned shutdown triggers the creation of a file that contains the system state information, which can delay shutdown. Therefore, do not use zero for this parameter.

Windows 2000, Windows NT, and Windows Me/98/95: This parameter is ignored.
Und
Zitat:

uFlags
[in] Shutdown type. This parameter must include one of the following values.
[Tabelle]
This parameter can optionally include the following values.
Ergo muss es so heißen:
Delphi-Quellcode:
ExitWindowsEx(EWX_SHUTDOWN or EWX_FORCE);

emsländer 28. Jan 2005 17:23

Re: Windows XP beenden
 
Zitat:

Zitat von Luckie
Das kann nicht sein:
Zitat:

Code:
BOOL ExitWindowsEx(
  UINT uFlags,
  DWORD dwReason
);

Zitat:

dwReason
[in] Reason for initiating the shutdown. This parameter must be one of the system shutdown reason codes.
If this parameter is zero, the SHTDN_REASON_FLAG_PLANNED reason code will not be set and therefore the default action is an undefined shutdown that is logged as "No title for this reason could be found". By default, it is also an unplanned shutdown. Depending on how the system is configured, an unplanned shutdown triggers the creation of a file that contains the system state information, which can delay shutdown. Therefore, do not use zero for this parameter.

Windows 2000, Windows NT, and Windows Me/98/95: This parameter is ignored.
Und
Zitat:

uFlags
[in] Shutdown type. This parameter must include one of the following values.
[Tabelle]
This parameter can optionally include the following values.
Ergo muss es so heißen:
Delphi-Quellcode:
ExitWindowsEx(EWX_SHUTDOWN or EWX_FORCE);

Dann ist es vielleicht irgendein Zufall - aber es klappt!

Gruss

EL


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:26 Uhr.
Seite 6 von 7   « Erste     456 7      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz