Wednesday, August 27, 2008

StandBy & Hibernate

In Windows XP there are many DLLs. In each Dll, there some functions are named API Functions. Windows launches these functions by RUNDLL32.exe . RUNDLL32 has some parameters. Via these parameters you can tell RUNDLL32 to load which dll and launch what function.
Powrprof.dll in SYSTEM32 is a class library for putting your computer in Stand by or Hibernate mode.

Press ' WindowsKey + R ' to open Run. Now type one of these two commands and press Enter:

Command for StandBy:
rundll32 Powrprof,SetSuspendState 0,1,1

Command for Hibernate:
rundll32 Powrprof,SetSuspendState 1,1,1


Also you can create a new shortcut and insread of a location of an item, type one the commands above. The shortcut will put your PC to StandBy or Hibernate mode.


VB.Net StandBy & Hibernate code:

'StandBy
Application.SetSuspendState(PowerState.Suspend, True, True)

'Hibernate
Application.SetSuspendState(PowerState.Hibernate, True, True)


C# StandBy & Hibernate code:

// Standby
Application.SetSuspendState(PowerState.Suspend, true, true);

// Hibernate
Application.SetSuspendState(PowerState.Hibernate, true, true);


Special Thanks to C-SharpCorner.Com by Thiagarajan Alagarsamy

No comments: