![]() |
nach hochfahren aus hibernate fährt pc gleich wieder runter
Hi,
ich habe einen Mediaplayer programmiert, und in diesen auch die Möglichkeit eingebaut den PC zu einer vorbestimmten Zeit aus dem Ruhezustand oder Standby Mode zu starten. Dies funktioniert per SetwaitableTimer einwandfrei. Nun ist aber bei manchen Rechnern das Problem, das diese sich zwar dann einschalten um diese Zeit, aber erst wenn ich mit der Maus klicke, läuft wirklich alles los, bis dahin scheint der PC zwar aktiv aber in einem Pause modus zu sein oder so etwas. Auch ein Tastaturklick oder nur eine Mausbewegung bringen nichts, nur der Mausklick aktiviert den PC letztendlich und dann startet auch mein Mediaplayer usw... Wenn aber nun in ca 2 minuten keiner die Maus klickt, geht der PC von allein wieder zurück in den Ruhezustand. Kann ich das irgendwie verhindern? Ich würde gerne geweckt werden von meiner Musik und nicht nur von den Lüftergeräuschen *g* :-) Kann ich irgendwie on Resumesuspend oder irgendsowas irgendwo abfragen und dann nen mausklick simulieren? Hab ich mal probiert hat aber nicht geklappt. Hat jemand da bessere Kenntnisse? Gruß tom |
Re: nach hochfahren aus hibernate fährt pc gleich wieder run
Füge mal eine Timer mit Beep; aller 'ner Sekunde (oder 3 oder 4 Sekunden ...) in dein Programm ein.
Wenn es nach dem Start dann nicht Beept, dann kannst du etwas Programmseitiges vergessen, da dein Programm/PC dann vermutlich nicht läuft. |
Re: nach hochfahren aus hibernate fährt pc gleich wieder run
Hi,
ok werde ich mal testen, aber auch wenn das nicht geht, da es eben das mit dem waitableTimer gibt, muss das ganze doch auch irgendwie machbar sein das der Rechner dann wirklich startet sonst wäre das waitabletimer zeugs ja total sinnlos eigentlich... oder? Evtl muss man auch dem Rechner vorher sagen, das er nach diesem Standby/Ruhezustand nach dem hochfahren auch weiter laufen soll, vielleicht gibts da ne extra funktion oder so? Gruß tom |
Re: nach hochfahren aus hibernate fährt pc gleich wieder run
Zitat:
|
Re: nach hochfahren aus hibernate fährt pc gleich wieder run
Das mit den 2 Minuten ist Absicht! Hier ein Auszug aus MSDN zu System Wake-up Events:
Zitat:
![]() |
Re: nach hochfahren aus hibernate fährt pc gleich wieder run
Hi,
ja aber da hab ich nichts derartiges gefunden alles was so wakeup mässig drinnen is is aktiviert. Und setwaitable timer is ja auch nicht im BIOS zu finden aber trotzdem eine Funktion die vom BIOS unterstützt werden muss. Auch wenn es Absicht ist muss es doch zu umgehen sein? Oder nicht? Weil sonst ist das ja absolut zwecklos... ich hatte irgendwo mal was gehört das man dem System sagen kann das es nun benötigt wird und eben nicht wieder ausschalten soll...aber ich weiß nicht wie Gruß tom |
Re: nach hochfahren aus hibernate fährt pc gleich wieder run
Zitat:
das MSDN sagte doch This timer gives applications sufficient time to call the SetThreadExecutionState function to indicate that they are busy. |
Re: nach hochfahren aus hibernate fährt pc gleich wieder run
Hi,
also muss dieses SetThreadExecutionState das sein was ich meinte, das mein thread bzw die app eben sagt jetzt das machen nicht ausgehen. Ok, aber wie implementier ich das? Gruß tom |
Re: nach hochfahren aus hibernate fährt pc gleich wieder run
Zitat:
![]() |
Re: nach hochfahren aus hibernate fährt pc gleich wieder run
Hi,
C bringt mir aber nicht viel, ich weiß trotzdem nicht wie ichs einbauen soll.... also für Player wäre das dann SetThreadExecutionState( ES_DISPLAY_REQUIRED ); so in der art... aber wann und wo starte ich die funktion? Gruß tom |
Re: nach hochfahren aus hibernate fährt pc gleich wieder run
Hi,
ich hab eben noch etwas gefunden auf einer taiwanesischen seite :-) System Wake-up Events ====================== Your application can restore an On-Now capable computer that is in a sleeping state to the working state by using a scheduled time or a device event. This is known as a wake-up event. Use a waitable timer object to specify the time at which the system should wake. To create the object, use the CreateWaitableTimer function. To set the timer, use the SetWaitableTimer function. The pDueTime parameter specifies when the timer will be signaled. To specify that the system should wake when the timer is signaled, set the fResume parameter to TRUE. When the system wakes automatically because of an event (other than power switch or user activity), the system automatically sets its idle timer to at least 1 minute. This timer allows applications to call the SetThreadExecutionState function to indicate that they are busy. This enables the system to shut down without affecting the user. The following criteria determine whether a system shutdown is needed: If the system wakes automatically, it shuts down as soon as the last job is completed, as indicated by the process calling SetThreadExecutionState. If the system wakes automatically, but the user provides new input while the event is handled, the system does not shut down when the last job finishes. If the system is on and the user is active, the system does not enter the sleeping state. If the system is on, no applications are busy, and the user is inactive for a long time, the system enters the sleeping state when the timer expires. //-- Das ist wohl der zeitpunkt hier wo ich dem System sagen muß das es nun gebraucht wird: When the system wakes automatically, the system broadcasts the PBT_APMRESUMEAUTOMATIC event to all applications. Because the user is not present, most applications should do nothing. Event-handling applications, such as fax servers, should handle their events. If you wish to determine whether the system is in this state, call the IsSystemResumeAutomatic function. //------------------- If the system wakes due to user activity after broadcasting PBT_APMRESUMEAUTOMATIC, the system broadcasts the PBT_APMRESUMESUSPEND event and turns on the display. Your application should reopen files that it closed when the system entered the sleeping state, and it should prepare for user input. If an application called SetSystemPowerState with fForce set to TRUE, no applications will receive the PBT_APMQUERYSUSPEND event when the system enters the sleeping state. If the system is carrying out a critical suspension, no applications will receive the PBT_APMQUERYSUSPEND or PBT_APMSUSPEND event; they will receive only the PBT_APMRESUMECRITICAL event. ------------------------------- Wie reagiere ich nun auf diesen Broadcast? lg tom |
Re: nach hochfahren aus hibernate fährt pc gleich wieder run
|
Re: nach hochfahren aus hibernate fährt pc gleich wieder run
Hi nochmal,
ich denke so in der art müsste es gehen:
Delphi-Quellcode:
unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, jwawinbase, JwaWinNT; type TForm1 = class(TForm) private { Private-Deklarationen } public { Public-Deklarationen } procedure WMPowerBroadcast(var MyMessage: TMessage); message WM_POWERBROADCAST; end; var Form1: TForm1; const PBT_APMQUERYSUSPEND = $0000; PBT_APMQUERYSTANDBY = $0001; PBT_APMQUERYSUSPENDFAILED = $0002; PBT_APMQUERYSTANDBYFAILED = $0003; PBT_APMSUSPEND = $0004; PBT_APMSTANDBY = $0005; PBT_APMRESUMECRITICAL = $0006; PBT_APMRESUMESUSPEND = $0007; PBT_APMRESUMESTANDBY = $0008; PBTF_APMRESUMEFROMFAILURE = $00000001; PBT_APMBATTERYLOW = $0009; PBT_APMPOWERSTATUSCHANGE = $000A; PBT_POWERSETTINGCHANGE = $8013; PBT_APMOEMEVENT = $000B; PBT_APMRESUMEAUTOMATIC = $0012; implementation {$R *.dfm} procedure TForm1.WMPowerBroadcast(var MyMessage: TMessage); begin if MyMessage.Msg = WM_POWERBROADCAST then begin if (MyMessage.WParam = PBT_APMQUERYSUSPEND) or (MyMessage.WParam = PBT_APMQUERYSTANDBY) then begin // windows wants to go into standby or hibernation mode // Hier hin, was getan werden muss, bevor Windows in den Standby darf, // z.B. Netzwerk- oder Datenbankverbindungen trennen, Timer abstellen, etc. MyMessage.Result := 1; // allow standby/hibernation // MyMessage.Result := BROADCAST_QUERY_DENY; // deny standby/hibernation end else if (MyMessage.WParam = PBT_APMRESUMEAUTOMATIC) or (MyMessage.WParam = PBT_APMRESUMECRITICAL) or (MyMessage.WParam = PBT_APMRESUMESUSPEND) or (MyMessage.WParam = PBT_APMRESUMESTANDBY) then begin // windows returns from standby or hibernation // Hier z.B. Verbindungen wiederherstellen // und Windows sagen das es benötigt wird und sich nicht automatisch ohne Usereingabe wieder ausschaltet SetThreadExecutionState(ES_SYSTEM_REQUIRED); SetThreadExecutionState(ES_DISPLAY_REQUIRED); SetThreadExecutionState(ES_CONTINUOUS); end; end; end; end. lg tom |
Re: nach hochfahren aus hibernate fährt pc gleich wieder run
Bit-Felder kann man verknüpfen :-D
Delphi-Quellcode:
SetThreadExecutionState(ES_SYSTEM_REQUIRED or ES_DISPLAY_REQUIRED or ES_CONTINUOUS);
|
Re: nach hochfahren aus hibernate fährt pc gleich wieder run
Hi,
cool thanx :-) ja und habs eben mit ruhezustand und standby getestet mit setwaitabletimer und pc fährt hoch bildschirm an player läuft los :-) Astrein Danke für die Hilfe Gruß tom |
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:26 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz