今天从CSDN上看到一篇关于待机状态下使用程序唤醒电脑的代码,感觉很好,不过没有试过,现把代码转过来以供日后有用的时候再试一下。
using System; using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles; using System.Threading; using System.ComponentModel; namespace ConsoleApplication1 { class Program { [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); static void Main(string[] args) { SetWaitForWakeUpTime(); } static void SetWaitForWakeUpTime() { DateTime utc = DateTime.Now.AddMinutes(1); long duetime = utc.ToFileTime(); using (SafeWaitHandle handle = CreateWaitableTimer(IntPtr.Zero, true, “MyWaitabletimer”)) { if (SetWaitableTimer(handle, ref duetime, 0, IntPtr.Zero, IntPtr.Zero, true)) { using (EventWaitHandle wh = new EventWaitHandle(false, EventResetMode.AutoReset)) { wh.SafeWaitHandle = handle; wh.WaitOne(); } } else { throw new Win32Exception(Marshal.GetLastWin32Error()); } } // You could make it a recursive call here, setting it to 1 hours time or similar Console.WriteLine(“Wake up call”); Console.ReadLine(); } } }
错误信息: 1 HTTP Status 500 – Internal Server Error 2 Type […]...
问题:如何上传图片到博客园的文章中? 步骤: 1.先把需要上传的图片上传到博客园自带的相册 2.然后点击相册中 […]...
JAVA 的 Date、Calendar的常用用法 最近在做项目的时候用到Date 和Calendar比较多, […]...
Visio高级应用部件 标注与公式的应用: 插入标注 怎么让标注与图形建立关联:拖动标注的时候坐下角会出现黄色 […]...
目录 Oracle ASM管理监控命令 目的: 1.查看磁盘组 2.查看目前归档 3.查看ASM的磁盘路径 4 […]...
Retrilo based voice conversion,简称RVC,是基于WITS语音合成系统的变声器。可以实现完美实时变声,适合直播、视频录制等多种场景。这篇文章主要为大家介绍一下RVC的使用方法,以及在文章底部提供简单的一键安装包,方便大家本地部署和使用,其中有为大家提供最新的版本可以兼容各种版本的模型,稳定性也得到了提升。...
假设表结构如下: CREATE TABLE TestTable ( id int identity, […]...
dot net 5 + dapper实现的webapi框架,简约不简单。 我真傻,真的。我单知道雪天是野兽在深 […]...