How to Hibernate from .NET Apps and How to enable Hibernate in Windows XP
Posted
on Microsoft .NET Support Team
See other posts from Microsoft .NET Support Team
Published on Thu, 10 Feb 2011 22:16:00 +0000
Indexed on
2011/02/10
23:31 UTC
Read the original article
Hit count: 367
.NET Tips and Tricks
|Windows
- Right click on Desktop.
- Click on properties.
- Go to screen save tab.
- Click on power button
- Select Hibernate tab
- Check the checkbox “Enabled Hibernate”
- Apply the settings.
Now when you try to shutdown, “Shut down windows” dialog shows “Hibernate” options. Now you can safely close the machine without closing your applications or windows as they will be restored once you on the machine.
</SPAN?Some time you might want to provide this future programmatically for the applications you develop for windows. Generally you might want to provide this option in windows applications where process needs huge time. Download managers are the one of the best example. below is the code to do a Hibernate from the .NET code.
using System.Windows.Forms;
namespace CodeKicks.WinApp.Machine
{
public static class MyMachineHelper
{
public static void DoHibernate()
{
//Application.SetSuspendState(PowerState.Suspend, true, false);
Application.SetSuspendState(PowerState.Hibernate, true, false);
}
}
}
© Microsoft .NET Support Team or respective owner