standby

Receive event before Windows enters standby or hibernate using Win32 API

元气小坏坏 提交于 2019-12-06 13:35:29
问题 I'm working on a small chat application written in C++/Qt. My users are complaining that the connection is not shut down gracefully when they are closing the laptop lid and the computer enters standby. Is there a Win32 hook available that is called when Windows is about to enter standby? 回答1: WM_POWERBROADCAST 回答2: Reimplement QCoreApplication::winEventFilter in your application to handle Windows standby events. 来源: https://stackoverflow.com/questions/5440133/receive-event-before-windows

What's the best between AlarmManager and Handler+WakeLock?

有些话、适合烂在心里 提交于 2019-12-05 19:53:20
I'm using for my Android Service an Handler that reapeat some operation each 60 minutes (1 hour), with a PartialWakeLock to keep the phone not sleeping. But this cause a lot of battery usage. So a decided to study about AlarmManager (i'm noob) that someone wrote here to be perfect for this kind of things.. But now reading along the web i find that who uses AlarmManager, still need a WakeLock. Is it true? What is the best way to run a cycle each 60 minutes (1 hour), without kill the battery? Thanx P.S. AlarmManager Android Developer The Alarm Manager holds a CPU wake lock as long as the alarm

Stop system entering 'standby'

跟風遠走 提交于 2019-12-05 16:14:51
How can i stop the host machine entering standby mode while my application is running? Is there any win32 api call to do this? There are two APIs, depending on what version of Windows. XP,2000, 2003: http://msdn.microsoft.com/en-us/library/aa373247(VS.85).aspx Respond to PBT_APMQUERYSUSPEND. Vista, 2008: http://msdn.microsoft.com/en-us/library/aa373208(VS.85).aspx There could be many valid reasons to prevent the computer from going to sleep. For example, watching a video, playing music, compiling a long running build, downloading large files, etc. This article http://www.codeguru.com/cpp/w-p

Receive event before Windows enters standby or hibernate using Win32 API

蹲街弑〆低调 提交于 2019-12-04 21:20:39
I'm working on a small chat application written in C++/Qt. My users are complaining that the connection is not shut down gracefully when they are closing the laptop lid and the computer enters standby. Is there a Win32 hook available that is called when Windows is about to enter standby? WM_POWERBROADCAST Reimplement QCoreApplication::winEventFilter in your application to handle Windows standby events. 来源: https://stackoverflow.com/questions/5440133/receive-event-before-windows-enters-standby-or-hibernate-using-win32-api

How to put monitor on standby and not let it wake up

一曲冷凌霜 提交于 2019-12-02 15:08:50
问题 I have 3 monitors, but I don't need them all turned on all the time. I can just shut them down with power button, but I want to use their standby mode, like Windows does when we let PC idle for a while - it shuts down monitors, HDD, etc. But of course, I wanna keep using PC and let just that monitor on standby. Others must remain on and that one doesn't wake up even with me using PC. Is it possible to do that? It would be great to have a shortcut like Winkey + 1 , 2 , 3 etc to shut down and

How to put monitor on standby and not let it wake up

拥有回忆 提交于 2019-12-02 08:22:55
I have 3 monitors, but I don't need them all turned on all the time. I can just shut them down with power button, but I want to use their standby mode, like Windows does when we let PC idle for a while - it shuts down monitors, HDD, etc. But of course, I wanna keep using PC and let just that monitor on standby. Others must remain on and that one doesn't wake up even with me using PC. Is it possible to do that? It would be great to have a shortcut like Winkey + 1 , 2 , 3 etc to shut down and wake up each monitor. An existing app with this feature is not likely to exist, but is there a Windows

Connected standby notification for a W8 Service

我的梦境 提交于 2019-11-30 09:11:55
I have a service, developed in C++ running on Windows 8 (and 8.1). How can I get to know that the system has entered Connected Standby? Since this is a service, it does not have a window, I should be using PowerRegisterSuspendResumeNotification , but it does not seem to be working. Does anyone know how I can get such a notification? I have contacted Microsoft's technical support. This is their answer: There are no direct notifications for ConnectedStandby enter/exit, but you can just use the monitor on/off notifications since ConnectedStandby is synonymous with screen off on an AOAC capable

Playing music in sleep/standby mode in Android 2.3.3

邮差的信 提交于 2019-11-29 05:21:02
I am trying to develop a simple media player to play mp3's of the sdcard/music directory for Android 2.3.3. The problem is when I hit the power button or when the device goes to sleep, the music stops. From googling, and searching stackoverflow, I found that I need to use the wake lock options, but no matter what I do, the music stops when the device goes to sleep (Pressing F7 on the emulator stops the music as well). Since I've been fighting this for way too long, I thought I'd ask for help. I would sincerely appreciate any input. Thanks. Here's my code: FileInputStream fis = new

How to make the Android device hold a TCP connection to Internet without wake lock?

好久不见. 提交于 2019-11-28 04:25:30
I want my application to be connected to server though the mobile connection, yet allowing the device to go into sleep mode. I expect it to wake up when IP packates arrives. How can this be done? How to receive "interrupts" from the Internet without draining battery? When you are blocked on a read from a tcp stream the device can go into a deep sleep and when tcp traffic comes in it will briefly wakeup the device, as soon as a bit is read in you start a wakelock until you have received the whole transmission then release it. Here is an example with web sockets, I've ran this app for over 12

Playing music in sleep/standby mode in Android 2.3.3

北慕城南 提交于 2019-11-27 23:07:57
问题 I am trying to develop a simple media player to play mp3's of the sdcard/music directory for Android 2.3.3. The problem is when I hit the power button or when the device goes to sleep, the music stops. From googling, and searching stackoverflow, I found that I need to use the wake lock options, but no matter what I do, the music stops when the device goes to sleep (Pressing F7 on the emulator stops the music as well). Since I've been fighting this for way too long, I thought I'd ask for help.