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.