473,320 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

equivalent of win32 waitable timer

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?
Jan 12 '06 #1
5 2466
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?
Jan 12 '06 #2
"Lonewolf" <an*******@mozilla.org> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
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?


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
Jan 13 '06 #3

"Lonewolf" <an*******@mozilla.org> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
| 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.

Jan 13 '06 #4

"Willy Denoyette [MVP]" wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...

"Lonewolf" <an*******@mozilla.org> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
| 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..._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.

Jan 19 '06 #5
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.


"Ben Voigt" <bv****@nospam.nospam> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
|
| "Willy Denoyette [MVP]" wrote in message
| news:%2***************@TK2MSFTNGP12.phx.gbl...
| >
| > "Lonewolf" <an*******@mozilla.org> wrote in message
| > news:%2***************@TK2MSFTNGP12.phx.gbl...
| > | 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..._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.
| >
| >
| >
|
|
Jan 19 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: elastic | last post by:
I'm trying to implement a simple timer to work on win32 (98,2k,xp), solaris and linux. where the last two are simple, the first seems to be problematic. the problem is that the kill command seems...
3
by: Russell Warren | last post by:
Does anyone know how long it takes for time.clock() to roll over under win32? I'm aware that it uses QueryPerformanceCounter under win32... when I've used this in the past (other languages) it...
1
by: Dinesh Eswaran | last post by:
hi all, I want to create a waitable timer in C#. How do I do it? There is Timer class and there is the WaitHandle class with WaitAny... methods. But they dont seem to help. Basically iam looking...
9
by: Nadav | last post by:
Hi, I am tring to pass messages between threads, using the good old C++ I would call the GetMessage/PostThreadMessage APIs, Now, I am using C# and i can't find any equivalenty for these calls, any...
0
by: Sam | last post by:
Hi, i'm using a win32 timer and when the time elapsed i'd like to trigger an event. I know I should use delegate but I can't find any example as I'm not familiar with that notion. Can you help ? ...
2
by: Mike | last post by:
Hello everyone: I am looking for some VB.NET code samples that make use of waitable timers that put the thread of the application to Sleep for the specificied period of time. I am told that the...
0
by: Sam | last post by:
Hello: Can anyone provide me some idea on how to replace the Sleep method. Major Disadvantage that I have been facing with the Sleep method is that the application freezes during the sleep time...
7
by: Marina Levit [MVP] | last post by:
Does anyone knows if this exists? Basically, a way to tell a method to execute, but a certain amount of time after the current event chain is finished - not immediately. With setTimeout, even if it...
11
by: =?Utf-8?B?RXJpYw==?= | last post by:
I'm coming from Win32 world. Now, I'm porting the existing code to C#. I cannot find the equivalent Win32 Waitable Timer in C#. I have a thread to perform some task periodically like following: ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.