我需要每天在特定时间唤醒一台冬眠的笔记本电脑...... 我应该使用pinvoke吗?如是?哪一个?怎么样? tnx很多!
答案 0 :(得分:2)
你可以将电脑从睡眠中唤醒,我不确定是否休眠。 This example告诉您如何操作。简而言之,您使用这两个导入:
[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);
我只在Windows Vista和7上测试过,这些可能在XP上无法使用。
答案 1 :(得分:1)
我知道它是VB而不是C#,但是看看this example,它确实要求你的主板符合某些要求。