473,399 Members | 2,159 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,399 software developers and data experts.

hibernate and stand by

Does someone have an example of C# code (VS 2005) that puts a system into
hibernation or stand by and then after some period of time wakes up the
system?

I need to write a test that does this functionality.

--
-----------
Thanks,
Steve
Feb 2 '06 #1
5 9840

"Steve Teeples" <St****@newsgroups.nospam> wrote in message
news:21**********************************@microsof t.com...
| Does someone have an example of C# code (VS 2005) that puts a system into
| hibernation or stand by and then after some period of time wakes up the
| system?
|
| I need to write a test that does this functionality.
|
| --
| -----------
| Thanks,
| Steve

As far as I know, there is no way to enter standby/hibernate state from user
code, that is without user intervention. You can awake a system by using a
timer (System.Timers.Timer or Threading.Timer), a system in standby or
hibernate state will wake up at the next timer event.

Willy.
Feb 2 '06 #2
Is there a power management class in .NET 2.0?
--
-----------
Thanks,
Steve
"Willy Denoyette [MVP]" wrote:

"Steve Teeples" <St****@newsgroups.nospam> wrote in message
news:21**********************************@microsof t.com...
| Does someone have an example of C# code (VS 2005) that puts a system into
| hibernation or stand by and then after some period of time wakes up the
| system?
|
| I need to write a test that does this functionality.
|
| --
| -----------
| Thanks,
| Steve

As far as I know, there is no way to enter standby/hibernate state from user
code, that is without user intervention. You can awake a system by using a
timer (System.Timers.Timer or Threading.Timer), a system in standby or
hibernate state will wake up at the next timer event.

Willy.

Feb 2 '06 #3
No, but there is a Win32 API to set this state, provided your system is ACPI
compliant and the BIOS is set-up to enable S4 and/or S3.

Here is the declaration (not tested!)....

[DllImport("PowrProf")]
extern static bool SetSuspendState( bool hibernate, bool force , bool
disablewakeup );

usage:

SetSuspendState(true, true, false); // force hibernate, disable all wakeup
events
SetSuspendState(false, true, true); // force suspend and enable wake events.
SetSuspendState(false, false, true); // broadcast PBT_APMQUERYSUSPEND event
and suspend if all agree.

Willy.
"Steve Teeples" <St****@newsgroups.nospam> wrote in message
news:FC**********************************@microsof t.com...
| Is there a power management class in .NET 2.0?
| --
| -----------
| Thanks,
| Steve
|
|
| "Willy Denoyette [MVP]" wrote:
|
| >
| > "Steve Teeples" <St****@newsgroups.nospam> wrote in message
| > news:21**********************************@microsof t.com...
| > | Does someone have an example of C# code (VS 2005) that puts a system
into
| > | hibernation or stand by and then after some period of time wakes up
the
| > | system?
| > |
| > | I need to write a test that does this functionality.
| > |
| > | --
| > | -----------
| > | Thanks,
| > | Steve
| >
| > As far as I know, there is no way to enter standby/hibernate state from
user
| > code, that is without user intervention. You can awake a system by using
a
| > timer (System.Timers.Timer or Threading.Timer), a system in standby or
| > hibernate state will wake up at the next timer event.
| >
| > Willy.
| >
| >
| >
Feb 2 '06 #4
Thanks. This is just what I was looking for.
--
-----------
Thanks,
Steve
"Willy Denoyette [MVP]" wrote:
No, but there is a Win32 API to set this state, provided your system is ACPI
compliant and the BIOS is set-up to enable S4 and/or S3.

Here is the declaration (not tested!)....

[DllImport("PowrProf")]
extern static bool SetSuspendState( bool hibernate, bool force , bool
disablewakeup );

usage:

SetSuspendState(true, true, false); // force hibernate, disable all wakeup
events
SetSuspendState(false, true, true); // force suspend and enable wake events.
SetSuspendState(false, false, true); // broadcast PBT_APMQUERYSUSPEND event
and suspend if all agree.

Willy.
"Steve Teeples" <St****@newsgroups.nospam> wrote in message
news:FC**********************************@microsof t.com...
| Is there a power management class in .NET 2.0?
| --
| -----------
| Thanks,
| Steve
|
|
| "Willy Denoyette [MVP]" wrote:
|
| >
| > "Steve Teeples" <St****@newsgroups.nospam> wrote in message
| > news:21**********************************@microsof t.com...
| > | Does someone have an example of C# code (VS 2005) that puts a system
into
| > | hibernation or stand by and then after some period of time wakes up
the
| > | system?
| > |
| > | I need to write a test that does this functionality.
| > |
| > | --
| > | -----------
| > | Thanks,
| > | Steve
| >
| > As far as I know, there is no way to enter standby/hibernate state from
user
| > code, that is without user intervention. You can awake a system by using
a
| > timer (System.Timers.Timer or Threading.Timer), a system in standby or
| > hibernate state will wake up at the next timer event.
| >
| > Willy.
| >
| >
| >

Feb 2 '06 #5
If you are using .NET 2.0 you can just call Application.SetSuspendState.

Check out the documentation at:
http://msdn2.microsoft.com/en-us/lib...pendstate.aspx
Apr 27 '06 #6

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

Similar topics

1
by: Keith Simeon | last post by:
Hello all, I've recently started playing with Hibernate, and have a question regarding many-to-many relationships using a join or cross table (I've also heard these referred to as a transition...
1
by: chandukandula | last post by:
Hi Already my application in Struts using JDBC.At present my application is implemented in Struts with hibernate So i am not changing the SQL queries converting to the like this String...
6
rsrinivasan
by: rsrinivasan | last post by:
Hi all, I am using Hibernate framework in my project. This is my configuration in my "hibernate.cfg.xml" file. <property name="hibernate.c3p0.max_size">25</property> <property...
3
by: altafur | last post by:
hi, i am using java with hibernate . i want to run a hibernate order by query thru java. i have written the query in hibernate.hbm.xml file. the query is as follows: query: SELECT distinct...
0
by: neuraljay | last post by:
hi everyone. I am trying to build a jsp using webwork, hibernate and mysql. And right now I am doing its unit testing. Everytime I run the test I am getting this error: Error JDBC exception on...
1
by: ashi1290 | last post by:
I am getting this error..... Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:120)...
2
oll3i
by: oll3i | last post by:
I have hibernate plugin for eclipse (org.hibernate.eclipse_3.2.3.GA) it came together with eclipse europa , but when i do the import to use hibernate import org.hibernate.Session; import...
15
oll3i
by: oll3i | last post by:
Thank you for the last post :) now another problem when i flush the session hibernate throws nullpointerexception my code looks as follows import org.hibernate.Session; import...
1
by: CatchSandeepVaid | last post by:
I have posted this question in hibernate forums also.. As this forum is related to java, i am posting it here also ... In hibernate, presently one-to-one associations are fetched non-lazily... I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
0
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...

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.