hibernation

WPF Application: Wake computer from sleep or hibernation

和自甴很熟 提交于 2021-02-19 08:43:12
问题 The last day i've tried to make this work: Wake up my computer from sleep or hibernation, using a WPF application. Nothing i've tried worked. So far I've tried the most popular examples on the net.. For 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

GetPwrCapabilities is giving me wrong sleep state results on some computers. How can I get a more accurate result?

放肆的年华 提交于 2020-06-13 09:13:33
问题 I have a 64-bit Win7 Ultimate machine that I'm calling GetPwrCapabilities on. However it tells me that sleep state 4 (hibernation) is not available and that there is no hibernation file. I can hibernate the machine and there is a hibernation file. Am i doing something wrong? Is there anything else I can call to get accurate supported sleep states Thanks EDIT It's interesting that powercfg -AVAILABLESTATES provides the correct information. Does anyone know what API it calls or why there is a

Are there suspend\resume signals in Linux?

扶醉桌前 提交于 2019-12-06 02:05:28
问题 My application needs to react on hibernation mode so it can do some action on suspending and other actions on resuming. I've found some distributive-specific ways to achieve it(Upower + DBus) but didn't find anything universal. Is there a way to do it? Thanks! 回答1: A simple solution to this is to use a self-pipe. Open up a pipe and periodically write timestamps to it. select on this pipe to read the timestamps and compare them to the current time. When there is a big gap, that means you have