tags:

views:

103

answers:

2

I need to wake up a hibernated laptop at a given time every day... should i use pinvoke? if yes? wich one? how? tnx a lot!

+1  A: 

I know it's VB and not C#, but take a look at this example, it does require that your motherboard meets certain requirements.

ILMV
+1  A: 

You can wake the computer up from sleep, I'm not sure about hibernate. This example shows you how to do it. In short you use these two imports:

[DllImport("kernel32.dll")]
public static extern SafeWaitHandle CreateWaitableTimer(IntPtr lpTimerAttributes, bool bManualReset, string lpTimerName);

[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetWaitableTimer(SafeWaitHandle hTimer, [In] ref long pDueTime, int lPeriod, IntPtr pfnCompletionRoutine, IntPtr lpArgToCompletionRoutine, bool fResume);

I've only tested it on Windows Vista and 7, these may not be available on XP.

Chris S