Launch program when hibernation ends?



DevilsPGD
07-10-2005, 12:46 AM
Does anybody know of a way to have a program launch when my system comes
out of hibernation?


--
"If it weren't for my horse, I wouldn't have spent
that year in college"
-- Lewis Black

David Candy
07-10-2005, 12:46 AM
You'll have to write a program. Windows sends a message to all programs when
coming out of hibernation. You have a program running and it starts whatever
when it gets told out of hibernation.


Platform SDK: Hardware

WM_POWERBROADCAST Messages
The system broadcasts a message to all applications and installable drivers
whenever a power management event occurs or whenever an application calls
the SetSystemPowerState function to suspend operation. The system broadcasts
these events through the WM_POWERBROADCAST message, setting the wParam
parameter to the appropriate power management event. For example, the
PBT_APMPOWERSTATUSCHANGE event indicates a system power status change. You
must ensure that your application responds to the WM_POWERBROADCAST message
to properly stop activity when the system enters the sleeping state and to
recover transparently when the system enters the working state. When the
system enters the sleeping state, it closes network connections. The user
can change the hardware configuration or power supply while the system is in
the sleeping state.

The system broadcasts a PBT_APMQUERYSUSPEND event to request permission to
suspend system operation. The system expects each application and driver to
determine whether the requested event should occur and to return TRUE if it
occurs, or return BROADCAST_QUERY_DENY otherwise. Any application or driver
can deny the request and prevent the event from occurring.

The system broadcasts a PBT_APMSUSPEND event immediately before suspending
operation. This gives applications and drivers one last chance to prepare
for the event. In many cases, the system broadcasts these messages without
requesting permission to do so. This happens, for example, if an application
forces suspension with the SetSystemPowerState function.

The system broadcasts the PBT_APMQUERYSUSPENDFAILED event whenever a
requested event is denied. These events notify applications and drivers to
continue operation as usual.

The system broadcasts the PBT_APMRESUMESUSPEND or PBT_APMRESUMECRITICAL
event when system operation has been restored. If an application received a
PBT_APMSUSPEND event before the computer was suspended, it will receive the
PBT_APMRESUMESUSPEND event. Otherwise, it will receive the
PBT_APMRESUMECRITICAL event.


Platform SDK Release: August 2001 What did you think of this topic?
Let us know. Order a Platform SDK CD Online
(U.S/Canada) (International)



"DevilsPGD" <spamsucks@crazyhat.net> wrote in message
news:eq9d915v5k8heacvegk19mecv6i8i7v60t@news.readfreenews.net...
> Does anybody know of a way to have a program launch when my system comes
> out of hibernation?
>
>
> --
> "If it weren't for my horse, I wouldn't have spent
> that year in college"
> -- Lewis Black

Torgeir Bakken \(MVP\)
07-10-2005, 12:46 AM
DevilsPGD wrote:

> Does anybody know of a way to have a program launch when my
> system comes out of hibernation?
Hi,

You can use a VBScript (.vbs file) for this:

http://groups.google.co.uk/group/microsoft.public.windowsxp.general/msg/825a351962a258b8?dmode=source&hl=en


I suggest you set the script to start as part of the user logon.

E.g. put the script (or a shortcut to script) in the Startup
folder for "All Users":

C:\Documents and Settings\All Users\Start Menu\Programs\Startup



--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

DevilsPGD
07-10-2005, 12:47 AM
In message <uFfmTeqYFHA.980@TK2MSFTNGP12.phx.gbl> "Torgeir Bakken
\(MVP\)" <Torgeir.Bakken-spam@hydro.com> wrote:

>DevilsPGD wrote:
>
>> Does anybody know of a way to have a program launch when my
>> system comes out of hibernation?
>Hi,
>
>You can use a VBScript (.vbs file) for this:
>
>http://groups.google.co.uk/group/microsoft.public.windowsxp.general/msg/825a351962a258b8?dmode=source&hl=en

Awesome, thanks!


--
Sticks and stones may break my bones, but improperly spelled insults
merely amuse me.


Launch program when hibernation ends?