equivalent of win32 waitable timer

L

Lonewolf

Hi all,
I am not sure if it is even possible to do it from .NET itself. Is
there something like a waitable timer which can resume the system from
its hibernate or standby (S3: suspend to ram) mode. I'm trying to use C#
to create something that can "wake" the system up at a particular time
(set by user) if it is in hibernate or standby mode to do certain task
and after which to put it back to sleep again. Is it possible? I'm using
VS2005. Please enlighten me on this. thank you for your time and
patience. :)

I know of the power mgmt mode in .NET which can put the system to sleep,
but how to use waitable timer to wake it up?
 
L

Lonewolf

Lonewolf said:
Hi all,
I am not sure if it is even possible to do it from .NET itself. Is
there something like a waitable timer which can resume the system from
its hibernate or standby (S3: suspend to ram) mode. I'm trying to use C#
to create something that can "wake" the system up at a particular time
(set by user) if it is in hibernate or standby mode to do certain task
and after which to put it back to sleep again. Is it possible? I'm using
VS2005. Please enlighten me on this. thank you for your time and
patience. :)

I know of the power mgmt mode in .NET which can put the system to sleep,
but how to use waitable timer to wake it up?

*ding dong* no one has even tried it before?
 
W

William DePalo [MVP VC++]

Lonewolf said:
*ding dong* no one has even tried it before?

This may not be the best group to post the question. Like many here, I
expect, if I were to find myself needing something that I didn't find in a
five minute scan of the framework docs, I'd just use the Win32 API via
P/Invoke or C++ interop.

Regards,
Will
 
W

Willy Denoyette [MVP]

| Lonewolf wrote:
| > Hi all,
| > I am not sure if it is even possible to do it from .NET itself. Is
| > there something like a waitable timer which can resume the system from
| > its hibernate or standby (S3: suspend to ram) mode. I'm trying to use C#
| > to create something that can "wake" the system up at a particular time
| > (set by user) if it is in hibernate or standby mode to do certain task
| > and after which to put it back to sleep again. Is it possible? I'm using
| > VS2005. Please enlighten me on this. thank you for your time and
| > patience. :)
| >
| > I know of the power mgmt mode in .NET which can put the system to sleep,
| > but how to use waitable timer to wake it up?
|
| *ding dong* no one has even tried it before?


The win32 waitable timers are all wrapped by the System.Timers,
System.Threading.Timers namespace classes. But these wont help you anyway,
because a system that is in S3 or hibernated state does not run any code, so
your timer would not fire anyway. A standby or hibernated system can only be
resumed by an external event like a keyboard, mouse, network event or other
HW (programmable timer) supplied event.

Willy.
 
B

Ben Voigt

in message
| Lonewolf wrote:
| > Hi all,
| > I am not sure if it is even possible to do it from .NET itself. Is
| > there something like a waitable timer which can resume the system from
| > its hibernate or standby (S3: suspend to ram) mode. I'm trying to use
C#
| > to create something that can "wake" the system up at a particular time
| > (set by user) if it is in hibernate or standby mode to do certain task
| > and after which to put it back to sleep again. Is it possible? I'm
using
| > VS2005. Please enlighten me on this. thank you for your time and
| > patience. :)
| >
| > I know of the power mgmt mode in .NET which can put the system to
sleep,
| > but how to use waitable timer to wake it up?
|
| *ding dong* no one has even tried it before?


The win32 waitable timers are all wrapped by the System.Timers,
System.Threading.Timers namespace classes. But these wont help you anyway,

not according to:
http://msdn.microsoft.com/library/en-us/power/base/system_wake_up_events.asp
because a system that is in S3 or hibernated state does not run any code,
so
your timer would not fire anyway. A standby or hibernated system can only
be
resumed by an external event like a keyboard, mouse, network event or
other
HW (programmable timer) supplied event.

And waitable timer is the Win32 API for setting up hardware timers. Not
seeing any .NET calls for it.
 
W

Willy Denoyette [MVP]

Sorry, you are (partly) right, I was forgotten about On-Now capable boxes
(if not tuned off in the BIOS!).

But the System:Threading::Timer wraps the Waitable timer API's. This class
methods do call the internal CLR function 'InternalAddTimer' which calls the
CreateWaitableTimer and SetWaitableTimer Kernel32 API's.

So if you run something like this:

Timer* myWakeUpTimer =
new Timer(wakeUpDelegate, 0, 120000, -1);
Console::ReadLine();

And suspend the system, it will resume after the interval (60 sec.)

Willy.




|
| "Willy Denoyette [MVP]" wrote in message
| | >
| > | > | Lonewolf wrote:
| > | > Hi all,
| > | > I am not sure if it is even possible to do it from .NET itself.
Is
| > | > there something like a waitable timer which can resume the system
from
| > | > its hibernate or standby (S3: suspend to ram) mode. I'm trying to
use
| > C#
| > | > to create something that can "wake" the system up at a particular
time
| > | > (set by user) if it is in hibernate or standby mode to do certain
task
| > | > and after which to put it back to sleep again. Is it possible? I'm
| > using
| > | > VS2005. Please enlighten me on this. thank you for your time and
| > | > patience. :)
| > | >
| > | > I know of the power mgmt mode in .NET which can put the system to
| > sleep,
| > | > but how to use waitable timer to wake it up?
| > |
| > | *ding dong* no one has even tried it before?
| >
| >
| > The win32 waitable timers are all wrapped by the System.Timers,
| > System.Threading.Timers namespace classes. But these wont help you
anyway,
|
| not according to:
|
http://msdn.microsoft.com/library/en-us/power/base/system_wake_up_events.asp
|
| > because a system that is in S3 or hibernated state does not run any
code,
| > so
| > your timer would not fire anyway. A standby or hibernated system can
only
| > be
| > resumed by an external event like a keyboard, mouse, network event or
| > other
| > HW (programmable timer) supplied event.
|
| And waitable timer is the Win32 API for setting up hardware timers. Not
| seeing any .NET calls for it.
|
| >
| > Willy.
| >
| >
| >
|
|
 

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

Top