我想以编程方式从睡眠中唤醒系统,有什么办法可以做到这一点吗?
我已阅读以下链接:http: //developer.apple.com/mac/library/qa/qa2004/qa1340.html
这只谈到获得通知,但不确定是否有办法唤醒系统睡眠?
我很感激信息的一些线索......
更新:
根据我尝试使用IOPMSchedulePowerEvent的建议
我用过的代码:
NSCalendarDate *timeIntervalSinceNow = [NSCalendarDate dateWithTimeIntervalSinceNow:40];
IOReturn result = IOPMSchedulePowerEvent ((CFDateRef)timeIntervalSinceNow, NULL, CFSTR(kIOPMAutoWake));
Run Code Online (Sandbox Code Playgroud)
结果:
如果盖子关闭,它在MacBook中失败
我做错了什么或任何解决方案?
我在C#,.NET Framework 3.5(在VS 2010中)中有一个Windows窗体应用程序,我需要在安装应用程序后,当Windows从睡眠模式返回时(应用程序完全关闭且未运行),此应用程序启动即使用户需要输入他的密码(在这种情况下,在用户登录后),也是如此.
为什么我得到以下代码中找不到的类型或命名空间名称"ManagementEventWatcher":
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Management;
class Program {
public ManagementEventWatcher mgmtWtch;
static void Main(string[] args)
{
InitializeComponent();
mgmtWtch = new System.Management
.ManagementEventWatcher("Select * From Win32_ProcessStartTrace");
mgmtWtch.EventArrived += new
System.Management.EventArrivedEventHandler(mgmtWtch_EventArrived);
mgmtWtch.Start();
}
}
Run Code Online (Sandbox Code Playgroud)
我想我的dll没有这种方法,但如何检查?