WakeUp Event

  • Thread starter Thread starter Peter Ostermann
  • Start date Start date
P

Peter Ostermann

Hallo,

to start a certein routine when Windows XP is startet from
hibernate or standby, I need a info how to realize a possible
wakeup-event.

Does somebody have a hint how to do, or else in which NG I
may get this question answered? Thanks in advance.

Regards
Peter Ostermann
 
Hi Peter,

Check with the SDK groups. See also:

WM_POWERBROADCAST Messages:
http://msdn2.microsoft.com/en-gb/library/aa373248.aspx

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows XP Shell/User]
Windows® XP Troubleshooting http://www.winhelponline.com


Hallo,

to start a certein routine when Windows XP is startet from
hibernate or standby, I need a info how to realize a possible
wakeup-event.

Does somebody have a hint how to do, or else in which NG I
may get this question answered? Thanks in advance.

Regards
Peter Ostermann
 

Hi,
thanks for that hint.

I found a routine that recognises the wakeup
event. ***See code below***. I also got the .exe compiled from
that code. Works fine but opens message window
showing Day and Time of wakeup from hibernate.

The routine got to be changed to work in the background
and got to allow a parm-input for to specify the programm
reference that has to be stopped and started after hibernate.

Also the commands to be able to do so.
Is there anybody in this NG to give me a helping
hand doing those changes? Problem is also
that I do not have Delphi.

Regards
Peter


unit Hibernate_MAinform;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TMainform = class(TForm)
ListBox: TListBox;
procedure FormCreate(Sender: TObject);
private
procedure WMPowerBroadcast(var Msg: TMessage); message
WM_POWERBROADCAST;
public
{ Public-Deklarationen }
end;
var
Mainform: TMainform;
implementation

{$R *.dfm}
procedure TMainform.FormCreate(Sender: TObject);
begin
ListBox.Items.Add(FormatDateTime('yyyy-mm-dd hh:nn:ss', now) + ' -
Programm gestartet');
end;

procedure TMainForm.WMPowerBroadcast(var Msg: TMessage);
begin
if (Msg.WParam = PBT_APMQUERYSUSPEND) or
(Msg.WParam = PBT_APMQUERYSTANDBY)
then begin
If Msg.WParam = PBT_APMQUERYSUSPEND then
ListBox.Items.Add(FormatDateTime('yyyy-mm-dd hh:nn:ss', now) + ' -
Hibernate activated')
else
if Msg.WParam = PBT_APMQUERYSTANDBY then
ListBox.Items.Add(FormatDateTime('yyyy-mm-dd hh:nn:ss', now) + ' -
Standby activated');
Msg.Result := 1; // allow standby/hibernation
// Msg.Result := BROADCAST_QUERY_DENY; // deny standby/hibernation
end
else
if (Msg.WParam = PBT_APMRESUMECRITICAL) or
(Msg.WParam = PBT_APMRESUMESUSPEND) or
(Msg.WParam = PBT_APMRESUMESTANDBY)
then begin
// windows returns from standby or hibernation
// Hier z.B. Verbindungen wiederherstellen
If Msg.WParam = PBT_APMRESUMESUSPEND then
ListBox.Items.Add(FormatDateTime('yyyy-mm-dd hh:nn:ss', now) + ' -
Hibernate ended')
else
if Msg.WParam = PBT_APMRESUMESTANDBY then
ListBox.Items.Add(FormatDateTime('yyyy-mm-dd hh:nn:ss', now) + ' -
Standby ended');
end;
end;
end.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top