473,598 Members | 2,953 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2505
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*******@mozi lla.org> wrote in message
news:%2******** *******@TK2MSFT NGP12.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*******@mozi lla.org> wrote in message
news:%2******** *******@TK2MSFT NGP12.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.Threadin g.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******** *******@TK2MSFT NGP12.phx.gbl.. .

"Lonewolf" <an*******@mozi lla.org> wrote in message
news:%2******** *******@TK2MSFT NGP12.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.Threadin g.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:Threadin g::Timer wraps the Waitable timer API's. This class
methods do call the internal CLR function 'InternalAddTim er' which calls the
CreateWaitableT imer and SetWaitableTime r Kernel32 API's.

So if you run something like this:

Timer* myWakeUpTimer =
new Timer(wakeUpDel egate, 0, 120000, -1);
Console::ReadLi ne();

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

Willy.


"Ben Voigt" <bv****@nospam. nospam> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
|
| "Willy Denoyette [MVP]" wrote in message
| news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
| >
| > "Lonewolf" <an*******@mozi lla.org> wrote in message
| > news:%2******** *******@TK2MSFT NGP12.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.Threadin g.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
4331
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 to always fail. the pid is always negative and doesn't apear in the task manager. this is the perl version I'm using : This is perl, v5.6.1 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail)
3
2517
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 is a great high-res 64-bit performance counter that doesn't roll-over for many (many) years, but I'm worried about how many bits Python uses for it and when it will roll over. I need it to take years to roll over. I'm also aware that the actual...
1
4490
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 for the C# version of platform SDK's SetWaitableTimer Thanks Dinesh
9
13438
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 Idea how to communicate between threads and access the threads message queue will be appriciated... -- Nadav http://www.ddevel.com
0
941
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 ? I've done something like that but it doesn't work : Public Delegate Sub TimerElapsedEventHandler(ByVal sender As Object, ByVal e As TimerElapsedEventArgs)
2
4911
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 benefit of using a Waitable timer to the Threading.thread.Sleep function is that the application will still be responsive to events, whereas Threading.thread.Sleep will just freeze the application for the set interval. I have some VB6 code and a...
0
1139
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 and does not respond to any other events like the -- onComm event of the Serial port. I have been using a serial port class in VB.NET as serial port component does not exist in VB.NET. I am looking for somedata on how to use Waitable Timer APIs...
7
2080
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 says to execute in a second, that is really a second after the entire call chain is finished. So if the call chain happens to take 10 seconds to complete - the setTimeout method will execute in 11 seconds. Timers just execute at regular...
11
12785
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: While(...) { Do something ... SetWaitableTimer(hTimer, ...); WaitForSingleObject(hTimer, ...);
0
7894
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8284
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8392
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6711
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3894
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3938
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1500
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1245
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.