power-management

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

Detect “suspended” Windows 8/10 process

妖精的绣舞 提交于 2020-04-10 05:41:12
问题 UWP (or "Metro") apps in Windows 8/10 can be suspended when they are not in the foreground. Apps in this state continue to exist but no longer consume CPU time. It looks like this change was introduced to improve performance on low-power/storage devices like tablets and phones. What is the most elegant and simple method to detect a process in this state? I can see 2 possible solutions at the moment: Call NtQuerySystemInformation() and the enumerate each process and each thread. A process is

How to get WM_POWERBROADCAST message in CWinApp?

随声附和 提交于 2020-01-14 03:04:23
问题 I create the class that inherited CWinApp and this class has a timer (use a window timer). When PC go sleep mode and wake-up, timer callback is called exact time of wake-up. I want to make to not call the timer callback when PC is resuming from suspend. So I tried to use WM_POWERBROADCAST message. But this message didn't catch in PreTranslateMessage() API. Also I tried SetWindowLong() with my own API but still didn't catch the WM_POWERBROADCAST message. Is there any way to get WM

Android Static Variable Scope and Lifetime

让人想犯罪 __ 提交于 2020-01-13 12:07:32
问题 I have an application that has a Service that uses an ArrayList<Double> to store numbers in the background for a very long time; the variable is initialized when the service started. The service is in the background, and there will be frequent access to the variable (that's why I don't want to use file management or settings -- it will be very expensive for a file I/O for the sake of battery life). The variable will likely be ~1MB->2MB over its lifetime. Is it safe to say that the variable

Possible to find all Windows processes preventing automatic sleep, w/o admin rights?

不想你离开。 提交于 2020-01-13 04:00:06
问题 The command powercfg -requests will provide a list of processes that are currently preventing a Windows 10 device from automatically entering sleep mode. However, the command requires administrator permissions. Asking for admin access just to perform a simple informational query seems far from ideal. So is it possible to query the Windows 10 API for a similar list, in a user-space application? These processes are passing SetThreadExecutionState() the flags ES_SYSTEM_REQUIRED or ES_DISPLAY

How do you get the current battery level in .NET CF 3.5?

て烟熏妆下的殇ゞ 提交于 2020-01-10 02:14:06
问题 How - or what's the best way - to retrieve the device's current battery level in .NET CF 3.5 on Windows Mobile 5 and 6? 回答1: I think you want to use the Microsoft.WindowsMobile.Status namepsace (specifically the SystemState class. using Microsoft.WindowsMobile.Status; ... BatteryLevel batteryLevel = SystemState.PowerBatteryStrength; BatteryState batteryState = SystemState.PowerBatteryState; See this post for the full code sample. 回答2: You probably want the State Notification Broker class that

Uses of the monitor/mwait instructions

我们两清 提交于 2020-01-03 17:01:11
问题 I happened to stumble upon these two instructions - mwait and monitor https://www.felixcloutier.com/x86/mwait. The intel manual says these are used to wait for writes in a concurrent multi-processor system, and it made me curious what types of usecases were in mind when these instructions were added to the ISA. What are the semantics of these instructions? Is this integrated through linux into the threading libraries provided by posix (eg. does the thread yield while monitoring a word)? Or

android Power Management, Sleep mode, etc [closed]

主宰稳场 提交于 2020-01-01 19:00:57
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I have difficulty in understanding power management best practices and sleep mode state of android device. Sleep mode. 1.1) when will this happen? 1.2) CPU is going to sleep and my threads are suspend? and when will this happen? 1.3) To prevent CPU sleeping I can use PARTIAL_WAKE wake lock or alarm manager? What

Using Windows Power Management API to dim monitor

*爱你&永不变心* 提交于 2020-01-01 11:46:06
问题 I'm trying to do something that seems simple enough, I just want to have my program able to adjust the monitor brightness under certain conditions. So, I looked into the windows Power Management API and found some things that seemed like they would work for me. The core of the code I put together (basically, I referenced this) looks like this: GUID *pPwrGUID; GUID subGUID = GUID_VIDEO_SUBGROUP; GUID BriGUID = GUID_VIDEO_CURRENT_MONITOR_BRIGHTNESS; PowerGetActiveScheme(NULL, &pPwrGUID);

Android device age

时间秒杀一切 提交于 2019-12-31 04:58:12
问题 Is it possible to query the age of an android device? I want to know, how long a user owns his device. The age of the battery might be a good indicator, but I cannot find an appropriate API. Optimum would be something the timestamp of the first device boot. Any Ideas? 回答1: There is no solid way to find out the device age but yes somehow we can figure out the age. Android devices are packaged with some pre-installed apps(Sytem applications) and when user owns it, he installs other apps(User