<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx</link><description>In Power to the People we learned some of the differences between how PocketPCs and Smartphones handle power. In Power to the Developers part 1 we learned about some of the things a developer can do to manage his app's use of power. In preparing a part</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Power to the Developers part 2</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#450594</link><pubDate>Fri, 12 Aug 2005 01:36:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:450594</guid><dc:creator>Windows Mobile Team Blog</dc:creator><description>In Power to the People we learned that it's very bad for your app to use the CPU unnecessarily.&amp;amp;amp;nbsp;...</description></item><item><title>Power to the Developers part 2</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#450932</link><pubDate>Fri, 12 Aug 2005 20:15:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:450932</guid><dc:creator>Windows Mobile Team Blog</dc:creator><description>In Power to the People we learned that it's very bad for your app to use the CPU unnecessarily.&amp;amp;amp;nbsp;...</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#453016</link><pubDate>Thu, 18 Aug 2005 13:44:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:453016</guid><dc:creator>John Wei</dc:creator><description>Can you teach me how get into Unattended mode when wake up, like ativesync doing the sync .&lt;br&gt;I mean that every 5 minutes , my app wake up in the unattended mode,do some task ,into supsend mode. and repeat again after 5 minutes later.are ther any api can achieve that?&lt;br&gt;i have used the CeRnAppAtTime.But my app was run in On state...&lt;br&gt;please mail me the answer&lt;br&gt;my address is wjr87u@yahoo.com.tw&lt;br&gt;thank you so much.&lt;br&gt;best regards</description></item><item><title>Windows Mobile Power States</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#453327</link><pubDate>Fri, 19 Aug 2005 02:33:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:453327</guid><dc:creator>Mikel Berger</dc:creator><description>A good read for CPT 355 about power for Windows Mobile devices &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/windowsmobile/archive/2005/08/01/446240.aspx"&gt;http://blogs.msdn.com/windowsmobile/archive/2005/08/01/446240.aspx&lt;/a&gt; This is part of series on power, but one of the more interesting parts is the list of power states for smartphones and Pocket PCs from this post &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx"&gt;http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx&lt;/a&gt; * On: The user is interacting with the device. Everything is on. * BacklightOff: There has been a brief period of user inactivity (no one has pressed any buttons or touched a touchscreen). The backlight has been turned off, but everything else is on. When you set the backlight timeout values in the control panel, you're setting how long the system should wait before going into this state. (Note that this state is new for WM 5.) * UserIdle: There has been a longer period of user inactivity. Both the backlight and LCD have been turned off. When you set the screen timeout value on a Smartphone control panel, you're setting how long the system should wait before going into this state. This state is generally not used on PocketPC. There's no reason to turn the screen off when the device is about to go to sleep (sleeping turns the screen off). However, if/when PocketPCs go to the &amp;amp;quot;Always On&amp;amp;quot; model, they'll start using this state. * ScreenOff: You go into this state when someone specifically says to turn the screen (and backlight) off. For instance, in Media Player you can assign a button to turn the screen off. When you press it, we go into this state. This state is different than UserIdle, though. This state says, &amp;amp;quot;The user wants the screen off and doesn't want it to turn back on.&amp;amp;quot; UserIdle says, &amp;amp;quot;The user hasn't touched any buttons in a while, so we might as well turn the screen off to save power.&amp;amp;quot; In ScreenOff, pressing a button (other than the power button) doesn't turn the screen back on. In UserIdle, pressing a button does turn the screen back on. Both PocketPC and Smartphone use this state. * Unattended: This is a confusing state in which the screen, the backlight, and the audio are off. I won't go into too many details, other than to say that this is a PocketPC-only state that is used by applications which need to do things without alerting the user. While the PocketPC is in this state, the user thinks the device is asleep. For instance, ActiveSync when it syncs every 5 minutes. It's waking up, syncing, and going back to sleep, but the user can't tell. * Resuming: This is the state the PocketPC goes into when it wakes up from sleep. In this state, the screen is off, and there is a very short (15 second) timer before it goes back to sleep. The only way to keep the device from going back to sleep is to have something put it into one of the other states. This is really for dealing with spurious wakeups and for giving the system a way to get into Unattended without letting the user know about it. * Suspended: This is the PocketPC &amp;amp;quot;Sleep&amp;amp;quot; state. Everything is off, and the system isn't going to wake back up until some piece of hardware wakes it up. It's not actually an official Power Manager state, the way the other six are, but I'm including it for completeness....</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#471363</link><pubDate>Mon, 19 Sep 2005 20:47:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:471363</guid><dc:creator>windowsmobile</dc:creator><description>John, I'm sorry, I missed your comment back when.  I was just checking through comments now and saw it.  &lt;br&gt;&lt;br&gt;Here's how to enter and leave unattended mode.&lt;br&gt;&lt;br&gt;If you call:&lt;br&gt;PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE);&lt;br&gt;at the start of your app, it will enter unattended.&lt;br&gt;&lt;br&gt;Then, when you're ready to exit, call&lt;br&gt;PowerPolicyNotify(PPN_UNATTENDEDMODE, FALSE);&lt;br&gt;That will tell the system that you're done.&lt;br&gt;&lt;br&gt;This is what ActiveSync does.&lt;br&gt;&lt;br&gt;Mike Calligaro</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#578909</link><pubDate>Wed, 19 Apr 2006 14:51:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:578909</guid><dc:creator>MadDogX007</dc:creator><description>Is there anyway to automatically run application unattended on WM5?&lt;br&gt;&lt;br&gt;In otherwods, is there some consumer utility that will run an applicatin in WM5, unattended?</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#581052</link><pubDate>Sat, 22 Apr 2006 02:06:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:581052</guid><dc:creator>MikeCal</dc:creator><description>MadDog, are you asking if it's possible to say, &amp;quot;I'd like this application that's already on the device to run in unattended&amp;quot;? &amp;nbsp;&lt;br&gt;&lt;br&gt;If you can't change the application's code, you can't make the application itself run in unattended. &amp;nbsp;&lt;br&gt;&lt;br&gt;One thing you could do is have an application that puts the system into unattended and keeps it there. &amp;nbsp;I'm not sure if that's what you're looking for, though. &amp;nbsp;&lt;br&gt;&lt;br&gt;Can you tell me more about what you're trying to do? &amp;nbsp;What application would you like to be unattended and when?&lt;br&gt;&lt;br&gt;Mike</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#588781</link><pubDate>Wed, 03 May 2006 03:27:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:588781</guid><dc:creator>kernel</dc:creator><description>Here's one for you -&lt;br&gt;&lt;br&gt;In several HTC WM phone devices, setting the option to vibrate on new mail doesn't work when the device is in standby. &amp;nbsp;Is this by design, or a bug? &amp;nbsp;An example device is the HTC Wizard.&lt;br&gt;&lt;br&gt;If it's by design, please do something so that we can enable it, even if it's a reg entry. &amp;nbsp;If it's a bug, well...&lt;br&gt;&lt;br&gt;If the device would do a short vibe when new Direct Push mail is delivered, this would truly be close to a blackberry killer. &amp;nbsp;As it is, it's 70% there.</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#655126</link><pubDate>Mon, 03 Jul 2006 11:59:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:655126</guid><dc:creator>Tom Bradley</dc:creator><description>Hi there,&lt;br&gt;&lt;br&gt;As with John Wei, I'm also developing an application that requires the use of unattended mode. I've writtin a small test program based on your suggestion above, though I'm having a few issues.&lt;br&gt;&lt;br&gt;The test program wakes itself up using CeRunAppAtTime every minute, sets unattended mode, sleeps for 10 seconds, sets the next wake up event, then unsets unattended mode.&lt;br&gt;&lt;br&gt;1. When the device has woken up and entered unattended mode, the keyboard and touchscreen are active. An accidental press on a button or touch of the screen wakes the device up. Is there any way to fix this?&lt;br&gt;&lt;br&gt;2. Sometimes, like once an hour, the device will wake up completely. Its as if the call to request unattended mode didn't work.&lt;br&gt;&lt;br&gt;3. After a long time, say 3 hours, of waking up and sleeping, if I turn the device on I've lost the use of the touchscreen and have to soft reset before I can use it again.&lt;br&gt;&lt;br&gt;I'm using a Symbol MC70 running WM5&lt;br&gt;&lt;br&gt;Any help would be much appreciated.&lt;br&gt;&lt;br&gt;Tom</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#655139</link><pubDate>Mon, 03 Jul 2006 12:35:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:655139</guid><dc:creator>tomb@ibcos.co.uk</dc:creator><description>In addition to my previous post,&lt;br&gt;&lt;br&gt;I forgot to mention another anomaly I've been experiencing.&lt;br&gt;&lt;br&gt;The first time my application wakes the device up and enters unattended mode, the call to PowerPolicyNotify(PPN_UNATTENDEDMODE, FALSE) does not suspend the device again. After the user idle timer expires, it suspends the device for me, then all following calls to PowerPolicyNotify(PPN_UNATTENDEDMODE, FALSE) work. I've tried a variety of ways of suspending the device, including the user idle timeout. All seem to exhibit the same behavior.&lt;br&gt;&lt;br&gt;Cheers&lt;br&gt;&lt;br&gt;Tom</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#658224</link><pubDate>Thu, 06 Jul 2006 23:06:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:658224</guid><dc:creator>MikeCal</dc:creator><description>(Assume everywhere below when I say &amp;quot;LCD off&amp;quot; I mean the touch screen is off too.)&lt;br&gt;&lt;br&gt;John, the device is not behaving the way I expect it to. &amp;nbsp;If the device is suspended, then CeRunAppAtTime will cause it to go into the Resuming state, which has the LCD off. &amp;nbsp;When you put it into Unattended, it should leave the screen off. &lt;br&gt;&lt;br&gt;It sounds like that device turns the screen on during Resuming. &amp;nbsp;That is not our design. &amp;nbsp;However, Symbol makes vertical devices intended for specific uses, and we sometimes allow verticals to act differently than our designs if the changes are needed by their specialized customers. &amp;nbsp;It's possible that Symbol changed this behavior intentionally. &amp;nbsp;You'll need to work with them to see.&lt;br&gt;&lt;br&gt;For your second question, if the request to enter unattended mode failed, the device would suspend. &amp;nbsp;It will only wake up completely if something tells it to. &amp;nbsp;Maybe some other process is waking the device up?&lt;br&gt;&lt;br&gt;For your third question, the touch driver is OEM specific. &amp;nbsp;That's definitely something you'll need to work with Symbol on.&lt;br&gt;&lt;br&gt;And, as for the question in the second comment, it sounds like something else is running on the device that has requested unattended. &amp;nbsp;Unattended mode has a ref count that goes up every time someone requests unattended and goes back down every time someone releases it. &amp;nbsp;The system won't suspend immediately if the ref count isn't 0. &amp;nbsp;So, if something else is running that has requested unattended, then your requesting and releasing it won't suspend the system. &amp;nbsp;&lt;br&gt;&lt;br&gt;The ref count is cleared whenever the system wakes up from suspend, though. &amp;nbsp;So if something has bumped it, either it ran right when your app did, or the system wasn't actually suspended when you started your app the first time.&lt;br&gt;&lt;br&gt;Mike</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1034249</link><pubDate>Wed, 08 Nov 2006 14:54:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1034249</guid><dc:creator>Johan</dc:creator><description>&lt;p&gt;Hi all,&lt;/p&gt;
&lt;p&gt;We are using CeSetUserNotificationEx to wake up our application at certain points. Sometimes, not always, these notifications fails and we get the message &amp;quot;Notification error Can not execute program.exe&amp;quot;. The program really exists so this is not the problem. We think that there are some problems waking the unit up if it is in deep sleep and that the Notification Manager will fail in this case. Anyone else out there that have the same problem?&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1493123</link><pubDate>Fri, 19 Jan 2007 16:47:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1493123</guid><dc:creator>odo</dc:creator><description>&lt;p&gt;hi all,&lt;/p&gt;
&lt;p&gt;we have the same problem using CeSetUserNotificationEx. under pocket pc 2003 our application runs without any problems. under wm5 the notification manager cannot execute our application, because it is looking for the application in the wrong directory, although the correct directory is assigned in CE_NOTIFICATION_TRIGGER. And sometimes the application cannot be executed although it is in the directory where the notification manager expects it.&lt;/p&gt;
&lt;p&gt;anyone have an idea ?&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1515668</link><pubDate>Tue, 23 Jan 2007 20:14:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1515668</guid><dc:creator>Joel</dc:creator><description>&lt;p&gt;Hi all,&lt;/p&gt;
&lt;p&gt;I am using PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE) &amp;amp; PowerPolicyNotify(PPN_UNATTENDEDMODE, FALSE) around opening the serial driver. This works. If I turn the device off in the middle of opening the serial driver, the device goes into unattended mode and things progress nicely. The problem we are having is the power button acts strangely after we put the device in the unattended state, and requires 5 or so presses to turn the device on or off. From a user experience this is a big issue.&lt;/p&gt;
&lt;p&gt;Any ideas?&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1515934</link><pubDate>Tue, 23 Jan 2007 20:38:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1515934</guid><dc:creator>MikeCal</dc:creator><description>&lt;p&gt;Johan and Odo, I've seen the &amp;quot;can not execute program.exe&amp;quot; issue occasionally on my Nightly program. &amp;nbsp;I'm running on a Smartphone (which can be fully shut off) not a PocketPC (which can suspend), and for me, it only happens when the phone was fully off when the device was supposed to run. &amp;nbsp;Of course it only happens occasionally, so I don't have a good set of repro steps for it. &amp;nbsp;I've assumed there was an issue during boot of the notification firing before the filesystem is finished loading. &amp;nbsp;I don't have a good solution for it, though. &amp;nbsp;Sorry.&lt;/p&gt;
&lt;p&gt;Joel, the way the device is supposed to work is that when in unattended mode, a press of the power button should turn the device on immediately. &amp;nbsp;This is handled by the OEM's keyboard driver calling a different power PowerPolicyNotify &amp;nbsp;(this time PPN_POWERBUTTONPRESSED) whenever the power button is pressed. &amp;nbsp;It's possible that the keyboard driver on your device isn't doing this correctly. &amp;nbsp;Can you tell me which device it is? &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1516996</link><pubDate>Wed, 24 Jan 2007 01:42:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1516996</guid><dc:creator>Joel</dc:creator><description>&lt;p&gt;Mike,&lt;/p&gt;
&lt;p&gt;Thank you for your quick response. BTW, I appreciate your blog; it is helpful!&lt;/p&gt;
&lt;p&gt;Regarding the device I presume yes, but I am waiting for permission from the project manager to release the information. That said and assuming you are correct that the keyboard driver is not working correctly, is there an easy way for our application to hook the power button on/off and issue our own PPN_POWERBUTTONPRESSED (or suspend for that matter)? A hack by any other name... I am hooking other hard buttons but as I recall, the method does not work for the power button.&lt;/p&gt;
&lt;p&gt;FYI, when this device is in the unattended state it takes exactly 5 button presses to turn the device on if off, or off in on, and this behavior is not time based.&lt;/p&gt;
&lt;p&gt;Joel&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1518305</link><pubDate>Wed, 24 Jan 2007 03:53:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1518305</guid><dc:creator>MikeCal</dc:creator><description>&lt;p&gt;Unfortunately, any way to hook the power button would be OEM driver specific. &amp;nbsp;The keyboard driver needs to tell us that the power button was pressed before we can tell your app that it happened. &amp;nbsp;My guess at the current problem is that the driver isn't doing that in the first place.&lt;/p&gt;
&lt;p&gt;One thing you can do to narrow the problem down is to have your app watch for one of the keys you CAN hook, and, when it's pressed, do:&lt;/p&gt;
&lt;p&gt;PowerPolicyNotify(PPN_POWERBUTTONPRESSED, 0);&lt;/p&gt;
&lt;p&gt;If that turns the screen on as normal, we will have a pretty good indication that if the keyboard driver were to do that things would work. &amp;nbsp;If that also takes 5 presses, I'll have to ponder more what's happening.&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1521919</link><pubDate>Wed, 24 Jan 2007 17:58:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1521919</guid><dc:creator>Joel</dc:creator><description>&lt;p&gt;Mike,&lt;/p&gt;
&lt;p&gt;Thanks for your idea and it palyed out as you expected; pressing the 'ok' button turned the device on or off with one click. We will be forwarding the issue to the OEM.&lt;/p&gt;
&lt;p&gt;The reason all this special case coding happened in the first place is that the OEM is loading and unloading the compact flash drivers on power up/down. What we are seeing is the drivers don't finish loading when powered off in the middle of loading/unloading (either by pressing the power button or by going back to sleep) and every so often, these drivers don't recover and will not make it to the PNP section or the registry when powered on, and consequently the cards do not work without a device reset. Your thoughts regarding?&lt;/p&gt;
&lt;p&gt;One more request for the moment: Resetting the idle time to keep the device from suspending works as expected. Given the default is three minutes, can we programmatically change to something smaller (say 30 seconds) before we reset, and then change back to whatever the original setting was?&lt;/p&gt;
&lt;p&gt;Joel&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1522862</link><pubDate>Wed, 24 Jan 2007 21:00:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1522862</guid><dc:creator>Joel</dc:creator><description>&lt;p&gt;Mike,&lt;/p&gt;
&lt;p&gt;Sorry about the spelling errors. It was early this morning.&lt;/p&gt;
&lt;p&gt;The device we are using is the TDS Recon X running Windows Mobile 5.&lt;/p&gt;
&lt;p&gt;Joel&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1523595</link><pubDate>Thu, 25 Jan 2007 00:08:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1523595</guid><dc:creator>MikeCal</dc:creator><description>&lt;p&gt;Hi Joel,&lt;/p&gt;
&lt;p&gt;I don't work with TDS, so if you're already in contact with them and they're receptive to your issues, that's a good path. &amp;nbsp;In general, all they really need to do for the Hibernate issue is to replace whatever they're currently doing when the power button is pressed (I suspect they're sending a VK_OFF) with the PowerPolicyNotify. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;The CF drivers issue is more complicated. &amp;nbsp;The OEM has a number of places in the suspend and resume processes where they can control what's happening and how long things take. &amp;nbsp;They should be making sure that their drivers fully unload/load. &amp;nbsp;So, while the PowerPolicyNotify is certainly the EASIER fix, fixing the CF driver is the correct one.&lt;/p&gt;
&lt;p&gt;I don't think I understand your idle time question. &amp;nbsp;The default is 3 minutes, but the UI allows users to set it as low as 1 minute. &amp;nbsp;For that reason, we suggest that apps call SystemIdleTimerReset &amp;nbsp;every 30 seconds. &amp;nbsp;That's guaranteed to be more often than the minimum idle time and has a good amount of room for slop. &amp;nbsp;You could get away 45 seconds, and could probably get away with 59 seconds, but 30 seconds is definitely safe.&lt;/p&gt;
&lt;p&gt;But I don't think that's what you're asking. &amp;nbsp;Are you asking to programatically change the timeout value itself? &amp;nbsp;If so, I'd need to know more about what you're trying to do. &amp;nbsp;Are you worried about resetting the idle timer a few seconds before you finish what you're doing, leaving unattended, and then having the system stay awake for almost 3 minutes? &amp;nbsp;That won't happen. &amp;nbsp;The system suspends immediately after leaving unattended mode.&lt;/p&gt;
&lt;p&gt;Mike &lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1556051</link><pubDate>Tue, 30 Jan 2007 11:59:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1556051</guid><dc:creator>odo</dc:creator><description>&lt;p&gt;hi mike,&lt;/p&gt;
&lt;p&gt;thank you for your response !&lt;/p&gt;
&lt;p&gt;i don't think that it only deals with the filesystem..&lt;/p&gt;
&lt;p&gt;i changed the directory of the executable, but the OS still looks after it in the previous directory..&lt;/p&gt;
&lt;p&gt;i also cleanbooted (factory settings) the device (it is a symbol mc9094 wm5) and got the same message by the OS !!! &lt;/p&gt;
&lt;p&gt;odo&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1556067</link><pubDate>Tue, 30 Jan 2007 12:07:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1556067</guid><dc:creator>odo</dc:creator><description>&lt;p&gt;hi,&lt;/p&gt;
&lt;p&gt;where does the OS &amp;quot;save&amp;quot; the setting with the notification ? in the registry or somewhere else ?&lt;/p&gt;
&lt;p&gt;odo&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1663063</link><pubDate>Mon, 12 Feb 2007 21:44:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1663063</guid><dc:creator>Sean Howarth</dc:creator><description>&lt;p&gt;Hi Mike,&lt;/p&gt;
&lt;p&gt;Thanks for the great blog.&lt;/p&gt;
&lt;p&gt;We are using PowerPolicyNotify(PPN_POWERBUTTONPRESSED, 0) in our WM6 keyboard driver whenever the user presses the power button, and we're running into a problem when the power button is pressed twice quickly, the second time occurring before the device is suspended.&lt;/p&gt;
&lt;p&gt;It appears that the PowerPolicyNotify call is an asynchronous notification to the Power Manager, and the second notification we're issuing appears to be processed after the device is resumed, resulting in unexpected behavior.&lt;/p&gt;
&lt;p&gt;My question is, how should this situation be correctly handled?&lt;/p&gt;
&lt;p&gt;Thanks, Sean&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1671546</link><pubDate>Wed, 14 Feb 2007 01:07:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1671546</guid><dc:creator>MikeCal</dc:creator><description>&lt;p&gt;Sean, what kind of time are we talking about between the two presses? &amp;nbsp;Is it a case of hardware debouncing being needed, or is it a user physically pressing the button twice quickly? &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Is this an accurate description of what you're seeing?&lt;/p&gt;
&lt;p&gt;1) Device is awake and the user presses the button twice quickly&lt;/p&gt;
&lt;p&gt;2) Device goes to sleep&lt;/p&gt;
&lt;p&gt;3) User presses the power button again&lt;/p&gt;
&lt;p&gt;4) Device wakes up and then goes back to sleep&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1672415</link><pubDate>Wed, 14 Feb 2007 04:03:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1672415</guid><dc:creator>Sean Howarth</dc:creator><description>&lt;p&gt;Hi Mike,&lt;/p&gt;
&lt;p&gt;This is a case of the user physically pressing the button twice quickly (hardware debouncing has been disabled for the purpose of this test), and the situation is exactly as you describe. I should also mention that the keyboard driver calls PowerPolicyNotify once during the resume.&lt;/p&gt;
&lt;p&gt;We're also able to reproduce the behavior with an application calling PowerPolicyNotify twice before suspend, with a small wait between calls.&lt;/p&gt;
&lt;p&gt;I'm considering addressing this issue by flushing the PM policy notification queue during the keyboard power off handling. What are your thoughts on this approach?&lt;/p&gt;
&lt;p&gt;Also, what's the recommended way for an application to suspend the device? PowerPolicyNotify, GwesPowerOffSystem, SetSystemPowerState, or something else entirely?&lt;/p&gt;
&lt;p&gt;Thanks, Sean&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1677840</link><pubDate>Wed, 14 Feb 2007 21:29:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1677840</guid><dc:creator>MikeCal</dc:creator><description>&lt;p&gt;Sean, flushing the PM queue is a dangerous action. &amp;nbsp;It's possible that you'd throw out other things in the queue, like an application request to go to unattended, and break user scenarios like always up to date email. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I've talked with the Power Manager owner, and unfortunately, we don't have a good solution for you. &amp;nbsp;We believe that if you send a PPN_POWERBUTTONPRESSED while the system is suspending then it will be queued up and run again when the system wakes up (as you're seeing). &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I'd first verify with your customer that they find the &amp;quot;user presses the power button rapidly&amp;quot; feature to be compelling. &amp;nbsp;There are probably a hundred different WM devices on the market that don't guard against this that are doing fine.&lt;/p&gt;
&lt;p&gt;If your customer believes that this scenario is important, I guess my suggestion would be some sort of advanced debouncing on the power button. &amp;nbsp;You could grab the tick count when you send the PPN and store it in a variable. &amp;nbsp;When you go to send the next one, check to make sure sufficient time has passed. &amp;nbsp;Have some guard value like 0xFFFFFFFF that means to allow the PPN no matter what, and set the variable to that value in the keyboard power handler. &amp;nbsp;That way you can put a fairly large debounce time in and not have to worry about scenarios where the device does suspend and the user wants to turn it back on immediately.&lt;/p&gt;
&lt;p&gt;Regarding applications suspending the device, please give me the scenario you're trying to implement there. &amp;nbsp;There are few, if any, reasons for an application to suspend the device. &amp;nbsp;The application will almost never know what the user really wants to do and will likely do the wrong thing. &amp;nbsp;For instance, how will the application know that the user isn't watching a movie, or that always up to date email isn't syncing, etc?&lt;/p&gt;
&lt;p&gt;The one valid place I've ever seen for apps wanting to shut the system down is unattended ones. &amp;nbsp;For instance, if you have a app that needs to wake the system up every 5 minutes but only needs to run for a few seconds, you don't want the system to spend 3 minutes timing out only to start back up in 2 minutes. &amp;nbsp;Unattended mode was designed for that situation and handles it for you. &amp;nbsp;When the app leaves unattended mode, if nothing else is going on with the system, it will suspend immediately. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1695296</link><pubDate>Sat, 17 Feb 2007 16:22:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1695296</guid><dc:creator>Greg</dc:creator><description>&lt;p&gt;I have a problem with the message queue returned from a call to RequestPowerNotifications(mQue.Handle.ToInt32, PowerEventType.PBT_TRANSITION). Often the message returned from the message queue is not correct. &amp;nbsp;The normal sequence of events when the ON button is pressed is an event with a “resuming” message followed an event with an “on” message. In the code below the ‘on’ message is sometimes returned without being preceded by a “resuming” event. Other times neither event appears to be returned (It could be that the “resuming” event is returned without being followed by an ‘on’ event). Also, sometimes the “resuming” message is returned when the Pocket PC is turned off.&lt;/p&gt;
&lt;p&gt;Public Sub mQue_DataOnQueueChanged1(ByVal t As Object, ByVal e As EventArgs)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim bytes() As Byte&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim msg As New CustomMessage&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim rwr As ReadWriteResult = mQue.Receive(msg, 0)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Static Dim intCntr As Integer&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If (rwr = ReadWriteResult.OK) Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bytes = msg.MessageBytes&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PwrHandle = New CE_SystemPowerState.PowerClass(bytes.Length, bytes)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select Case msg.strSystemPowerState&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;on&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MsgBox(&amp;quot;intCntr = &amp;quot; &amp;amp; intCntr)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;intCntr = 0 &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;unattended&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim intI As Integer&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;intCntr = 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;For intI = 0 To 30000&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;intCntr = intCntr + 1&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Next&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If PwrHandle.PowerPolicyNotify(PwrHandle.PPN_Message.PPN_UNATTENDEDMODE, False) = False Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Exit Sub&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case &amp;quot;resuming&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; If PwrHandle.PowerPolicyNotify(PwrHandle.PPN_Message.PPN_UNATTENDEDMODE, True) = False Then&lt;/p&gt;
&lt;p&gt;Exit Sub&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case Else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;‘ Do nothing.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Select&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Sub&lt;/p&gt;
&lt;p&gt;When the message sequence returned is correct (“resuming&amp;quot; followed by “on”) when the user turns on the Pocket PC a message box appears containing the text “intCntr = 30001”. Sometimes (especially after the program is started fresh) the message box has the text “intCntr = 0” which indicated that the “resuming’ message was not returned before the ‘on’ message. After turning on and off about 5 times then the “intCntr = 30001” message appears for about 10 on/off cycles. Then “intCntr = 0” again appears (or sometimes no message box at all) for a couple of cycles before text “intCntr = 30001” returns again for a number of cycles.&lt;/p&gt;
&lt;p&gt;Is there any way to make the messages returned during power transitions more reliable?&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1718848</link><pubDate>Tue, 20 Feb 2007 00:30:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1718848</guid><dc:creator>MikeCal</dc:creator><description>&lt;p&gt;Greg, my VB is really rusty, so forgive me if I'm missing something. &amp;nbsp;But aren't you only incrementing intCntr to 30001 if the system is Unattended? &amp;nbsp;If the system goes from Resuming directly to On without doing Unattended, wouldn't that result in intCntr still being 0?&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1720900</link><pubDate>Tue, 20 Feb 2007 05:09:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1720900</guid><dc:creator>Greg</dc:creator><description>&lt;p&gt;Mike,&lt;/p&gt;
&lt;p&gt;Thank you for your reply. You are correct, intCntr only increments to 30001 if the system is Unattended. Shouldn't the system go into Unattended mode each time the &amp;quot;resuming&amp;quot; event message is returned? Why would the system goes from &amp;quot;resuming&amp;quot; directly to On without doing Unattended if I catch the &amp;quot;resuming&amp;quot; event in a Select Case block and call PowerPolicyNotify(PwrHandle.PPN_Message.PPN_UNATTENDEDMODE, True)? When I step through the code,&lt;/p&gt;
&lt;p&gt;If PwrHandle.PowerPolicyNotify(PwrHandle.PPN_Message.PPN_UNATTENDEDMODE, True) = False Then&lt;/p&gt;
&lt;p&gt;always returns True.&lt;/p&gt;
&lt;p&gt;What I do see when I step though the code is the value of msg.strSystemPowerState on the Select Case line does not always give the result I expect. When I press the power button to turn the device &amp;quot;Off&amp;quot;: most of the time I get a &amp;quot;suspend&amp;quot; message but sometimes I get a &amp;quot;resuming&amp;quot; message and occasionally a &amp;quot;unattended&amp;quot; message. When the &amp;quot;unattended&amp;quot; message is returned then the wireless LAN light blinks while power to the display is turned off. Pressing the power button several times fixes the problem of being in unattended mode when the device is supposed to be suspended.&lt;/p&gt;
&lt;p&gt;When I press the power button to turn the device on: most of the time the &amp;quot;resuming&amp;quot; message is first returned, followed by &amp;quot;unattended&amp;quot;, and finally &amp;quot;on&amp;quot;, and the msgbox appears with the text &amp;quot;intCntr = 30001”. Sometimes when I turn the device on the &amp;quot;on&amp;quot; message appears without being preceded by &amp;quot;resuming&amp;quot; and &amp;quot;unattended&amp;quot; messages. In this case &amp;nbsp;&amp;quot;intCntr = 0&amp;quot; appears which is what would be expected if the &amp;quot;resuming&amp;quot; did not precede the &amp;quot;on&amp;quot; message. The only way the &amp;quot;unattended&amp;quot; message would appear (and &amp;quot;intCntr = 30001”) is if a &amp;quot;resuming&amp;quot; message is returned first because the unattended state is called in the code block under &amp;quot;resuming&amp;quot;. If the power button is pressed to turn the device off and it goes into Unattended mode as stated above: if the device is turned on with an &amp;quot;on&amp;quot; event first then “intCntr = 30001” appears, where intCntr was set while device was supposed to be suspended but was actually in unattended mode.&lt;/p&gt;
&lt;p&gt;Sorry if I'm a bit verbose in describing the problem. I could sum up by saying that RequestPowerNotifications message queue appears to intermittently return the wrong power event. I am using a P2PmessageQueue to handle the messages from the power system. I assume messages are retrieved from a P2PmessageQueue object in a first in/first out basis. If P2PmessageQueue returns messages in no particular order, or on a first in/last out basis, then this would explain my problem.&lt;/p&gt;
&lt;p&gt;Thanks again,&lt;/p&gt;
&lt;p&gt;Greg&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#1736725</link><pubDate>Wed, 21 Feb 2007 22:04:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1736725</guid><dc:creator>MikeCal</dc:creator><description>&lt;p&gt;Greg, your device isn't behaving the way I suspect. &amp;nbsp;I believe there is an unattended app that is running more frequently than normal.&lt;/p&gt;
&lt;p&gt;On a typical suspended device, if you press the power button it will go from suspended to Resuming, and then from Resuming directly to On. &amp;nbsp;There's no reason for it to go to Unattended in that case.&lt;/p&gt;
&lt;p&gt;If the system wakes up due to an unattended app running, you'll typically see it go from suspended to Resuming, and then go to Unattended from there. &amp;nbsp;If, while the unattended app is running, you hit the power button, it will go to On.&lt;/p&gt;
&lt;p&gt;It's pretty unusual for the system to go from suspended to resuming to unattended to on all in one press of the power button. &amp;nbsp;Usually it's either already in unattended when you press the power button or it doesn't do unattended at all. &lt;/p&gt;
&lt;p&gt;On the suspend case, there's no guarantee that your app will run before the system suspends. &amp;nbsp;The system doesn't notify apps before suspending because it doesn't want apps to have the power to slow down the suspend. &amp;nbsp;So you're more likely to see the wake up than the suspend. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I'm pretty confident in the message queues. &amp;nbsp;They're used in a bunch of places throughout the system and work there. &amp;nbsp;I believe what they're telling you is happening is really happening. &amp;nbsp;I just don't understand why your system is working the way it is. &amp;nbsp;What unattended mode apps do you have on the system? &amp;nbsp;The two main ones that come with it are active sync when doing &amp;quot;always up to date&amp;quot; email and calnot/clocknot which run briefly at midnight. &amp;nbsp;There are some OEMs that do other things with unattended as well. &amp;nbsp;For instance, the Palm Treo uses unattended pretty significantly and frequently uses it if their hardware detects certain situations at resume. &amp;nbsp;Maybe you have something similar? &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#2114214</link><pubDate>Fri, 13 Apr 2007 15:33:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2114214</guid><dc:creator>Jozsef Zsido</dc:creator><description>&lt;p&gt;From what I know, the PowerPolicyNotify API manages an internal counter. Can this value be obtained from somewhere? (API, registry)&lt;/p&gt;
&lt;p&gt;I have trouble maintaining the Palm Treo 700w in the unattended state. It behaves like another process is reverting the effect of the PowerPolicyNotify and my application enters the suspended state.&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#2157255</link><pubDate>Mon, 16 Apr 2007 23:57:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2157255</guid><dc:creator>MikeCal</dc:creator><description>&lt;p&gt;Jozsef, are you calling SystemIdleTimerReset() every 30 seconds? &amp;nbsp;Unattended protects you against the user hitting the power button, and it allows you to wake the system up and do work without turning the screen on, but you still have to keep the system from timing out due to inactivity. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;We didn't want an app to call the PowerPolicyNotify, then crash, and lock the system on forever.&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#2601931</link><pubDate>Sun, 13 May 2007 18:49:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2601931</guid><dc:creator>jaigarru</dc:creator><description>&lt;p&gt;Greg,&lt;/p&gt;
&lt;p&gt;How do you make to get aware of any power change with RequestPowerNotifications in VB .NET? I want to create a queue to know when the power off button of my PDA is pressed, but I don't know how.&lt;/p&gt;
&lt;p&gt;Could you pass me the code (with as more details as possible, because all information I've find is in C and I can't understand it).&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#3565830</link><pubDate>Wed, 27 Jun 2007 17:21:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3565830</guid><dc:creator>Mitrich</dc:creator><description>&lt;p&gt;Hey buddy how to make my app not to go blackscreen? on both wince 4,5,6? I mean I use keybrd_event(..) every 10 seconds, but it doesnt work on wince 4. Also I dont know the name of the driver (BKL1, BKL2, BKLN...) so is there an easy way to tourn off for the time my app is runing this powersaving mode?&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#3661622</link><pubDate>Mon, 02 Jul 2007 19:52:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3661622</guid><dc:creator>MikeCal</dc:creator><description>&lt;p&gt;In Windows Mobile, we require that the backlight driver be named BKL1:, so you should be able to SetPowerRequirement on that. &amp;nbsp;Sorry, but I can't remember if the power infrastructure that relies on was available version 4. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#3859262</link><pubDate>Sat, 14 Jul 2007 07:07:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3859262</guid><dc:creator>Mark C</dc:creator><description>&lt;p&gt;I'm particularly interested in the ScreenOff state. &amp;nbsp;I think a stand alone utility that toggled the ScreenOff state would be an excellent power saver for my Samsung sgh-i607 smartphone, or any smartphone for tht matter.&lt;/p&gt;
&lt;p&gt;I realize that Media Player offers this functionality, but Media Player has to be running in order for it to work. &amp;nbsp;And, that workaround becomes ineffective when I connect to the smartphone with Active Sync and use an application called Pocket Controller, which allows me to fully control my smartphone from my PC. &amp;nbsp;Once I connect through Pocket Controller and want to navigate away from Media Player into something else, all the lights come back on, and that becomes annoying as well as a battery drain. &amp;nbsp;Particulary if I am connected to the device via Bluetooth.&lt;/p&gt;
&lt;p&gt;I'm not a programmer. Could you be so kind as to point me in the right direction, or even post the code C# needed to toggle ScreenOff state? &amp;nbsp;It would be great to have this utilty that could be assignable to a hardware key, so that it could be easily toggled on/off.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#3916716</link><pubDate>Tue, 17 Jul 2007 17:07:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3916716</guid><dc:creator>Trevor Morris</dc:creator><description>&lt;p&gt;I can't yet use the WM5 APIs, and have an application that requires the system to stay on, in order to receive wireless notifications. &amp;nbsp;I do turn the screen off, but have to periodically call SystemIdleTimerReset().&lt;/p&gt;
&lt;p&gt;Which of these is the best way to delay, so that the CPU can go idle:&lt;/p&gt;
&lt;p&gt; 1) Create a thread &amp;amp; Sleep.&lt;/p&gt;
&lt;p&gt; 2) Create a system event to call my app. &lt;/p&gt;
&lt;p&gt; 3) Create a timer.&lt;/p&gt;
&lt;p&gt; 4) Something else?&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#3940359</link><pubDate>Wed, 18 Jul 2007 20:18:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3940359</guid><dc:creator>MikeCal</dc:creator><description>&lt;p&gt;Mark, &lt;/p&gt;
&lt;p&gt;I'm not sure ScreenOff will really do what you want, though. &amp;nbsp;On smartphone (Your blackjack is a smartphone) pressing any key will turn the screen back on. &amp;nbsp;Then you'll need to invoke your program to turn it back off again. &amp;nbsp;You might find that invoking keylock works better. &amp;nbsp;When the device's keys are locked, the screen turns off automatically after 3 seconds. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you want to do ScreenOff, though, here's the code you need.&lt;/p&gt;
&lt;p&gt;I don't think there's a C# wrapper for SetSystemPowerState, but this is the C++ for turning off the screen.&lt;/p&gt;
&lt;p&gt;SetSystemPowerState(NULL, POWER_STATE_IDLE, 0);&lt;/p&gt;
&lt;p&gt;If you want to turn the screen on, replace POWER_STATE_IDLE with POWER_STATE_ON.&lt;/p&gt;
&lt;p&gt;If you want to pInvoke it, this should work:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;[DllImport(&amp;quot;coredll.dll&amp;quot;, SetLastError=true)]&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;static extern int SetSystemPowerState(string psState, int StateFlags, int Options);&lt;/p&gt;
&lt;p&gt;POWER_STATE_IDLE is 0x00100000&lt;/p&gt;
&lt;p&gt;POWER_STATE_ON is &amp;nbsp; 0x00010000&lt;/p&gt;
&lt;p&gt;I hope this helps,&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#3940383</link><pubDate>Wed, 18 Jul 2007 20:22:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3940383</guid><dc:creator>MikeCal</dc:creator><description>&lt;p&gt;Trevor, the methods you suggested are pretty equivalent. &amp;nbsp;However, how long do you plan to keep the system awake? &amp;nbsp;Keeping a PocketPC from suspending can have a pretty significant effect on battery life. &amp;nbsp;If you're going to do it for a few minutes, it's probably not an issue. &amp;nbsp;But if you're planning to keep the system on all the time, you're likely to cause trouble for your users. &amp;nbsp;What kind of notifications do you need to get? &amp;nbsp;Would it be possible to have the notification itself wake the system up so that your app can let it sleep?&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#3972169</link><pubDate>Fri, 20 Jul 2007 12:05:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3972169</guid><dc:creator>Mohammed</dc:creator><description>&lt;p&gt;hi , &lt;/p&gt;
&lt;p&gt; In Palm Treo &amp;nbsp;, the power key is mapped to call end key , when the call end/Power key is pressed the screen freezes up . how it could be handled . Is it in an unattended state&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#4258429</link><pubDate>Mon, 06 Aug 2007 16:01:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4258429</guid><dc:creator>Trevor Morris</dc:creator><description>&lt;p&gt;MikeCal wrote: &lt;/p&gt;
&lt;p&gt;&amp;gt;What kind of notifications do you need to get? &amp;nbsp;Would it be possible to have the notification itself wake the system up so that your app can let it sleep?&lt;/p&gt;
&lt;p&gt;The notifications are coming through a WiFi alert. &amp;nbsp;The user of the device is receiving an important message, whose time can't be predicted. &amp;nbsp;Is there a way to have a PocketPC wake up on this sort of event?&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#4266035</link><pubDate>Tue, 07 Aug 2007 00:03:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4266035</guid><dc:creator>MikeCal</dc:creator><description>&lt;p&gt;Unfortunately, no. &amp;nbsp;The WiFi stack runs on the main CPU, and that CPU is off when the system is suspended. &amp;nbsp;So you can't wake the CPU with a WiFi notification.&lt;/p&gt;
&lt;p&gt;Apps that need to get asyncronous WiFi communications (ie VOIP) either need to keep the system on all the time, or be run on a Smartphone instead of a PocketPC. &amp;nbsp;Smartphones already keep the system on all the time, but are tuned to do it well.&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#4300175</link><pubDate>Thu, 09 Aug 2007 02:29:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4300175</guid><dc:creator>Ryan</dc:creator><description>&lt;p&gt;Mike,&lt;/p&gt;
&lt;p&gt;I'm developing a .NET CF 2.0 app to run on a WM 5.0 PDA. &amp;nbsp;I want to do some processing in the middle of the night, and my idea was to use the transition from &amp;quot;suspend&amp;quot; to &amp;quot;unattended&amp;quot; to do this.&lt;/p&gt;
&lt;p&gt;By logging the power events that the RequestPowerNotifications gives me, I see that at midnight the device always wakes up for at least 15 seconds and sits in &amp;quot;unattended&amp;quot; mode.&lt;/p&gt;
&lt;p&gt;I would like to piggy back on this wakeup and simply perform my processing at that time. &amp;nbsp;Do all WM 5.0 devices wake up in this manner? &amp;nbsp;Or are there situations the device does not go into unattended mode in the night?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Ryan&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#4371659</link><pubDate>Mon, 13 Aug 2007 23:12:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4371659</guid><dc:creator>MikeCal</dc:creator><description>&lt;p&gt;Hi Ryan,&lt;/p&gt;
&lt;p&gt;Windows Mobile wakes up at midnight for two special processes: CalNot and ClockNot. &amp;nbsp;One updates Calender Notifications and one does Clock Notifications. &amp;nbsp;One runs every night at midnight and one runs every Sunday at midnight. &amp;nbsp;I can't remember which is which. &amp;nbsp;(-:&lt;/p&gt;
&lt;p&gt;These processes are on every Windows Mobile device, but it's not guaranteed that they will always be. &amp;nbsp;In some future version we could concievably change when they run, or get rid of them completely.&lt;/p&gt;
&lt;p&gt;There is a much safer way to do what you want. &amp;nbsp;If you call CeRunAppAtTime you can set the system to wake up and run your application at whatever time you'd like, including Midnight. &amp;nbsp;If you do that, you can run at the same time Cal/ClockNot runs, but continue to work even if we change them in the future.&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#4498611</link><pubDate>Tue, 21 Aug 2007 22:55:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4498611</guid><dc:creator>Tim</dc:creator><description>&lt;p&gt;Hi Mike,&lt;/p&gt;
&lt;p&gt;Thanks for all your posts. &amp;nbsp;They're great. &amp;nbsp;Here's my question: Does the CPU clock speed mode that you can set under Settings-&amp;gt;System-&amp;gt;Processor (WM5) have anything to do with these power states?&lt;/p&gt;
&lt;p&gt;We're using a PPC (FSC PocketLoox) as a dedicated device and want to tweak the CPU clock speed mode setting programmatically, but can't figure out how. &amp;nbsp;Can't seem to find any documentation on what this corresponds to. &amp;nbsp;Clearly this is processor dependent. &amp;nbsp;Is this an OEM-specific thing?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;Tim&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#4896128</link><pubDate>Thu, 13 Sep 2007 19:12:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4896128</guid><dc:creator>roozbeh</dc:creator><description>&lt;p&gt;Hi Mike,&lt;/p&gt;
&lt;p&gt;I have a program that shows a notification when an sms is recieved.butafter some seonds-i guess you said 6 seconds-it turns off device again.&lt;/p&gt;
&lt;p&gt;My program load a dll which loading it take around 6-7 seconds-becouse on loading it does some other things too-.&lt;/p&gt;
&lt;p&gt;So how can i prevent system from getting back into sleep mode.&lt;/p&gt;
&lt;p&gt;I think the calling SystemIdleTimerReset on another thread solve might the problem.but how much the interval should be?&lt;/p&gt;
&lt;p&gt;and also i read somewhere that keylock programs interfere with this and when keylock is on,calling this wont keep system alive..&lt;/p&gt;
&lt;p&gt;so is there any solution?&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#4896131</link><pubDate>Thu, 13 Sep 2007 19:13:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4896131</guid><dc:creator>roozbeh</dc:creator><description>&lt;p&gt;Hi Mike,&lt;/p&gt;
&lt;p&gt;I have a program that shows a notification when an sms is recieved.butafter some seonds-i guess you said 6 seconds-it turns off device again.&lt;/p&gt;
&lt;p&gt;My program load a dll which loading it take around 6-7 seconds-becouse on loading it does some other things too-.&lt;/p&gt;
&lt;p&gt;So how can i prevent system from getting back into sleep mode.&lt;/p&gt;
&lt;p&gt;I think the calling SystemIdleTimerReset on another thread solve might the problem.but how much the interval should be?&lt;/p&gt;
&lt;p&gt;and also i read somewhere that keylock programs interfere with this and when keylock is on,calling this wont keep system alive..&lt;/p&gt;
&lt;p&gt;so is there any solution?&lt;/p&gt;
</description></item><item><title>Power settings/CommonTime Mnotes</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#5242155</link><pubDate>Tue, 02 Oct 2007 16:22:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5242155</guid><dc:creator>Bob Walker</dc:creator><description>&lt;p&gt;Anyone out there familiar with CommonTime mNotes?!&lt;/p&gt;
&lt;p&gt;I have a question relating to our corporate PDA solution - M3100s (aka HTC Hermes) ROM version 2.11.61.1 running Windows Mobile 5 with CommonTime Msuite v.4.3.966 hooking into our Lotus Notes email for push etc&lt;/p&gt;
&lt;p&gt;Now...regarding Push. My understanding is as follows: The device registers with mnotes notification server &amp;quot;hello, I'm here&amp;quot;...if any new mail is waiting then mnotes will push it out to the commontime client on the device. &amp;nbsp;So far so good. I'm also under the impression that if the PDA is 'asleep', then it is no longer bothering to regsiter its self with the mnotes notification server, and therefore receives no push mail. To combat this, in the mnotes client there is a 'Device wakeup Period' slider which specifies a how often the device wakes up from its slumber to go regsiter with notification server. By default, this is set on the slider to happen every hour.&lt;/p&gt;
&lt;p&gt;So what power state constitutes 'asleep'in this instance? At what point does the PDA switch from receiving a new mail pretty much instantly...to being asleep and the device having to drag itself out of bed to go and handshake with the notification server to pick up new mail?!&lt;/p&gt;
&lt;p&gt;Bob&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#5465550</link><pubDate>Tue, 16 Oct 2007 02:54:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5465550</guid><dc:creator>MikeCal</dc:creator><description>&lt;p&gt;Sorry for such a late response. &amp;nbsp;It appears that I missed these questions.&lt;/p&gt;
&lt;p&gt;Tim: &lt;/p&gt;
&lt;p&gt;Processor speed is entirely an OEM thing. &amp;nbsp;There's nothing inherent in the OS that sets processor speeds, and anything regarding these speeds would be separate from the device states. &amp;nbsp;It's possible that the OEM choose to change rates at various states, but I wouldn't expect that. &amp;nbsp;It's more likely that they do it based on CPU idle than user inactivity. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;roozbeh:&lt;/p&gt;
&lt;p&gt;It sounds like you're being hit by the Resuming state. &amp;nbsp;SystemIdleTimerReset doesn't affect the resuming state. &amp;nbsp;If you search this page for &amp;quot;PPN_UNATTENDED&amp;quot; you'll find a comment where I explain what you need to do.&lt;/p&gt;
&lt;p&gt;Bob:&lt;/p&gt;
&lt;p&gt;I'm sorry, but I'm not familiar with mNotes. &amp;nbsp;I'm guessing, however, that the &amp;quot;asleep&amp;quot; you're talking about is whenever the system is suspended. &amp;nbsp;If you go into the Power control panel, you'll see words to the effect of &amp;quot;on battery power, suspend if the device is unused for 3 minutes.&amp;quot; &amp;nbsp;You can change the number of minutes there. &amp;nbsp;Whatever you set, if you don't interact with the device for that long it will suspend. &amp;nbsp;It will also suspend if you press the power button.&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#5839208</link><pubDate>Fri, 02 Nov 2007 19:14:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5839208</guid><dc:creator>Ian</dc:creator><description>&lt;p&gt;Is it possible to wake the device from sleep by pressing the screen not by button?&lt;/p&gt;
&lt;p&gt;So, when the device is standby (or screen off), user could press the screen to make the screen on again?&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#5919810</link><pubDate>Tue, 06 Nov 2007 00:45:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5919810</guid><dc:creator>MikeCal</dc:creator><description>&lt;p&gt;Ian, it is possible for an OEM to make hardware that acts that way, but I haven't seen any do so in a very long time. &amp;nbsp;The general problem with that concept is that the device will be touched while the device is in your pocket and that will drain your batteries. The last device to enable this had a clear plate that went over the screen to keep it from being touched when you didn't want it to be. &amp;nbsp;Needing to move the plate aside was worse than needing to press a power button.&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
</description></item><item><title>re: Power to the System - BlackJack, Smartphone idle mode, and WMP</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#5947370</link><pubDate>Wed, 07 Nov 2007 02:52:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5947370</guid><dc:creator>Jason</dc:creator><description>&lt;p&gt;Mike,&lt;/p&gt;
&lt;p&gt;On July 18, you mentioned how Smartphone (BlackJack specifically) keypresses turn the screen on if it's been turned off via POWER_STATE_IDLE. &lt;/p&gt;
&lt;p&gt;We'd like to keep the screen off in these circumstances, and receive the key messages to our application. When the user presses the correct key, we'd like to turn the screen back on. This happens for Windows Media Player on Smartphone - you toggle the screen and it stays off.&lt;/p&gt;
&lt;p&gt;We've tried looking for PBT_TRANSITIONs to POWER_STATE_ON from our queue, and then either turning the backlight off via another POWER_STATE_IDLE call, but then we don't get any key input.&lt;/p&gt;
&lt;p&gt;Watching what WMP does, when you press a key with the screen off, the system doesn't enter into any different mode - it stays idle, and the keys get to WMP somehow.&lt;/p&gt;
&lt;p&gt;How can this be achieved on Smartphones?&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#5963281</link><pubDate>Wed, 07 Nov 2007 19:08:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5963281</guid><dc:creator>Jason</dc:creator><description>&lt;p&gt;Mike,&lt;/p&gt;
&lt;p&gt;After doing more research, it looks like (at least on the BlackJack) the keyboard driver (keypad.dll) has &amp;quot;WMP for Mobile Devices&amp;quot; hardcoded to get special treatment. If the foreground window class matches, then the screen stays off.&lt;/p&gt;
&lt;p&gt;Unfortunately this string is hardcoded in the driver, and not the registry or anywhere else, so to fake it, we'd have to change our window class (tested, and it works) which isn't feasible. &lt;/p&gt;
&lt;p&gt;We actually ran into another (unrelated) issue with the BlackJack specifically - their wheel messages weren't being sent (that is, VK_UP/DOWN without the VK_ROCKER) to normal applications (to get the fancy listview handing for wheel vs. dpad). Their driver in this case looks for the MSStart (and other application classes). &lt;/p&gt;
&lt;p&gt;You may want to institute some guidelines for OEMs regarding this.&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#6271046</link><pubDate>Thu, 15 Nov 2007 22:10:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6271046</guid><dc:creator>Hrissan</dc:creator><description>&lt;p&gt;Thanks for the article!&lt;/p&gt;
&lt;p&gt;But what a mess those power-related problems! I never heard of anything designed so bad, sorry M$ guys, you do not have any idea how the good software is made. I see different hard-coding in OEM drivers every day. They do it not because they are stupid, but because they have no other way to get behavior they need... And we are not speaking about rocket science here.&lt;/p&gt;
&lt;p&gt;And now we need that special behavior in my application, but we cannot hard-code it into driver! IWe need it to work on hundreds different (but essentially the same) pieces of hardware... No way.&lt;/p&gt;
&lt;p&gt;You can censor my comment off, but Windows Mobile applications do not get any better from this. :(&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#6438370</link><pubDate>Tue, 20 Nov 2007 20:33:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6438370</guid><dc:creator>MikeCal</dc:creator><description>&lt;p&gt;Jason, we certainly didn't expect OEMs to hardcode app names into their driver. &amp;nbsp;)-: &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you tell me more about what your app is trying to do? &amp;nbsp;What is the scenario where you want the user to send your app keypresses without him seeing the screen? &amp;nbsp;In general, if I'm interacting with the device I expect the screen to be on. &amp;nbsp;If I'm not interacting with the device, I lock the keypad. &lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#6440570</link><pubDate>Tue, 20 Nov 2007 22:12:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6440570</guid><dc:creator>Jason</dc:creator><description>&lt;p&gt;The app in question is our media player product named Pocket Player, www.conduits.com/products/player, and users often want to keep the screen off when they are controlling the device. Media players would want this functionality; I'm not sure off-hand for other use case scenarios. It's the &amp;quot;ScreenOff&amp;quot; power mode above, and works on all devices except those that hardcode WMP in their driver.&lt;/p&gt;
&lt;p&gt;&amp;quot;Interacting with the device&amp;quot; could be limited to just pressing Action to pause playback but unfortunately the screen turns on after any keypress, unless we fake our window class name.&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#6465607</link><pubDate>Thu, 22 Nov 2007 09:09:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6465607</guid><dc:creator>MikeCal</dc:creator><description>&lt;p&gt;Jason, you have us scratching our heads here. &amp;nbsp;The usage you're describing is exactly what the &amp;quot;ScreenOff&amp;quot; state was designed for. &amp;nbsp;I checked with the owner of Power Manager today and he checked the code to be sure. &amp;nbsp;The only way out of ScreenOff is someone calling an Api or someone hitting the power button. &amp;nbsp;So it SHOULD be that if you put the system into ScreenOff, your users should be able to press buttons while keeping it off (so long as none of them are the power button). &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Does what you're seeing happen on all devices, or just the Blackjack? &amp;nbsp;There's an API they can call that forces the screen on. I wonder if they're doing it for every keypress or something.&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#6472854</link><pubDate>Thu, 22 Nov 2007 21:12:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6472854</guid><dc:creator>Jason</dc:creator><description>&lt;p&gt;Mike,&lt;/p&gt;
&lt;p&gt;My comment from November 6 was when we were scratching our heads too :) By November 7, we had figured out the issue: it's a BlackJack only problem and is caused by the keyboard driver. The problem doesn't happen on other Smartphones. &lt;/p&gt;
&lt;p&gt;It seems that the WM OEM kits should include some keyboard/power state test harnesses for the OEMs, and guidelines to never hardcode app class names into drivers. The BlackJack forcibly turns on the screen unless the current app is WMP. As mentioned before, the driver is also defective in that it never sends the VK_ROCKER/VK_DPAD notifications unless you are on the MSStart window (or an Open Picture dialog), hich helps with navigating listviews with a scrollwheel.&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#6535062</link><pubDate>Tue, 27 Nov 2007 00:18:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6535062</guid><dc:creator>Stefan</dc:creator><description>&lt;p&gt;Mike, &lt;/p&gt;
&lt;p&gt;I have a piece of code that uses CeSetUserNotificationEx to run applications at a given time. The code works fine on Smartphone, but on PocketPC it does not wake up the device, but rather queues up all notifications and runs them when the device is manually woken up. &lt;/p&gt;
&lt;p&gt;What would be the correct way to get this working this on the PocketPC. I have seen samples that suggest that CeSetUserNotificationEx is the way to do it on PocketPC but for some reason it does not work(The Pocket PC device is AT&amp;amp;T Tilt or HTC TyTn II if that matters).&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#6557193</link><pubDate>Tue, 27 Nov 2007 21:52:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6557193</guid><dc:creator>MikeCal</dc:creator><description>&lt;p&gt;Stefan, the correct way to do what you're describing is to use CeRunAppAtTime. &amp;nbsp;That will launch your app at the given time, and will wake up the PocketPC to do it (if necessary).&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#6642249</link><pubDate>Sun, 02 Dec 2007 16:13:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6642249</guid><dc:creator>skyntchev</dc:creator><description>&lt;p&gt;Thanks Mike,&lt;/p&gt;
&lt;p&gt;Unfortunately, CeRunAppAtTime does the same thing - &amp;nbsp;if the device is awake both CeSetUserNotificationEx and CeRunAppAtTIme work correctly. Once device is asleep they &amp;quot;queue&amp;quot; the notification(s) and run them once you wake up the device. I know that they are scheduled correctly and they run because the moment you press the power button everything executes as planned. Do you have any idea why would that happen? Can it be device specific (again the device is HTC Kaiser, TyTn II, AT&amp;amp;T Tilt). &amp;nbsp;&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#6642444</link><pubDate>Sun, 02 Dec 2007 17:27:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6642444</guid><dc:creator>Jason</dc:creator><description>&lt;p&gt;Stefan,&lt;/p&gt;
&lt;p&gt;It might be that the device is in Unattended mode, but is indeed running the application. This gets around the longstanding &amp;quot;device wakes up at midnight&amp;quot; problem.&lt;/p&gt;
&lt;p&gt;Try calling SetSystemPowerState(NULL, POWER_STATE_ON, 0) in your WinMain and see what happens.&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#6657233</link><pubDate>Tue, 04 Dec 2007 23:04:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6657233</guid><dc:creator>skyntchev</dc:creator><description>&lt;p&gt;Thanks Jason,&lt;/p&gt;
&lt;p&gt;I did quite a bit of experimentation and this is what I found. On Pocket PC, both CeRunAppAtTime, and CeSetUserNotificationEx both do wake up the device and do run correctly, IF the application they are trying to start is a native C++ app. The application I am trying to start is actually a &amp;nbsp;.NET CF application. In this case generally what I see is instead of starting my app, the system queues my scheduled events and starts them when the device wakes up.&lt;/p&gt;
&lt;p&gt;But here is another bizarre behavior. If I happen to have any (even completely unrelated) .NET process already running when device when to sleep in vast majority of cases (but not always) my app starts correctly at the scheduled time. I even tried set a native app to &amp;nbsp;start my .NET app (both using CreateProcess and ShellExecute) but the result is still the same – all gets queued up for wakeup.&lt;/p&gt;
&lt;p&gt;My current theory is that there is may be some time interval in which the application has to start and if it takes longer than that, the start is aborted and the task is queued for execution on wakeup. Does this make any sense?&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#6793903</link><pubDate>Tue, 18 Dec 2007 05:58:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6793903</guid><dc:creator>ayyrk</dc:creator><description>&lt;p&gt;Hi, I have a WM5 GPRS socket application that immediately tries to reconnect when the stream closes. I think the stream is closed on the client side when the value in &amp;quot;Turn off the device if it has not been used for xx minutes&amp;quot; is reached.&lt;/p&gt;
&lt;p&gt;I trace the socket communication on the server side and see the device disconnect and immediately reconnect. So it is never really suspending. It goes into a state where the screen is off and all buttons, except the power button, are disabled. But I can see on the server that it is continuously disconnecting/reconnecting. &lt;/p&gt;
&lt;p&gt;What do you think is preventing the device from suspending? Could it be something like a &amp;quot;wake on GPRS&amp;quot; setting?&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#7259456</link><pubDate>Sat, 26 Jan 2008 23:02:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7259456</guid><dc:creator>Hezi</dc:creator><description>&lt;p&gt;I have a WM5 application that needs to periodically check information from the RIL interface (say every 3 or 10 seconds).&lt;/p&gt;
&lt;p&gt;Currently, if no user input is entered the PPC would fall into the idle state (not suprisingly), thus stopping the application.&lt;/p&gt;
&lt;p&gt;I can use a few minutes timer and invoke the CeRunAppAtTime (for the same application) but am not sure this is the best way to revive the application.&lt;/p&gt;
&lt;p&gt;What would you suggest?&lt;/p&gt;
&lt;p&gt;BTW- I use C#&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#7322343</link><pubDate>Wed, 30 Jan 2008 11:20:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7322343</guid><dc:creator>std.denis</dc:creator><description>&lt;p&gt;Hey Mike,&lt;/p&gt;
&lt;p&gt;I'm glad that I found sucha great blog and I've got a several questions for you :)&lt;/p&gt;
&lt;p&gt;1. Could you tell me, please, what WM's thread scheduler do when it has nothing to do? For example, all threads are in an awaiting state. I'm almost completely sure that it is not using &amp;quot;while( no_new_external_events ) {}&amp;quot; to spend that &amp;quot;vacation&amp;quot; time.&lt;/p&gt;
&lt;p&gt;As I remember my university course the x86 has HLT command to make CPU freeze until an interrupt occur. Does WM use the same feature of CPU's it running on?&lt;/p&gt;
&lt;p&gt;Maybe it is not a responsibility of your team, but maybe you know how it done by OEMs in certain commercial devices.&lt;/p&gt;
&lt;p&gt;2. What is the best way to get current CPU's utilization? There's no GetSystemTimes on CE platform. I found idea to use CreateToolhelp32Snapshot + Thread32First/Next + GetThreadTimes. But that enumeration could be interrupted by thread switch, so we could get a mistake. Isn't it?&lt;/p&gt;
&lt;p&gt;Thank you,&lt;/p&gt;
&lt;p&gt;Denis Stanishevskiy&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#7436551</link><pubDate>Mon, 04 Feb 2008 16:06:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7436551</guid><dc:creator>Faiyaz</dc:creator><description>&lt;p&gt;I am shutting down a Psion Device (Win CE 5.0) using the following calls -&lt;/p&gt;
&lt;p&gt;FileSystemPowerFunction(1);&lt;/p&gt;
&lt;p&gt;PowerOffSystem();&lt;/p&gt;
&lt;p&gt;What api should I call to turn off the Keyboard backlight?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#7609731</link><pubDate>Mon, 11 Feb 2008 15:44:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7609731</guid><dc:creator>Hujer</dc:creator><description>&lt;p&gt;I have nearly the same situation as &amp;quot;Hezi&amp;quot;. &lt;/p&gt;
&lt;p&gt;I have a WM5/6 PPC application that needs to periodically check information from the WM registry.&lt;/p&gt;
&lt;p&gt;Currently, if no user input is entered the PPC would fall into the sleep mode, thus stopping the application.&lt;/p&gt;
&lt;p&gt;I can use a few seconds/minutes timer and invoke the CeRunAppAtTime (for the same application) but am not sure this is the best way to revive the application.&lt;/p&gt;
&lt;p&gt;What would you suggest?&lt;/p&gt;
&lt;p&gt;Please answer.&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#8204242</link><pubDate>Fri, 14 Mar 2008 17:41:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8204242</guid><dc:creator>Confuzzled</dc:creator><description>&lt;p&gt;What exactly is the difference between idle and useridle?&lt;/p&gt;
&lt;p&gt;SetSystemPowerState(NULL, POWER_STATE_IDLE, 0);&lt;/p&gt;
&lt;p&gt;SetSystemPowerState(NULL, POWER_STATE_USERIDLE, 0);&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#8513937</link><pubDate>Fri, 16 May 2008 20:11:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8513937</guid><dc:creator>Alex</dc:creator><description>&lt;p&gt;well, i think taht &amp;nbsp;u can help me. When I turn off button of my device (G-smart), GSM signal down, and I dont receive callas and sms. This device dont have rom upgrade anymore (out of production). Any idea for solution?? arovaris@hotmail.com&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#8572789</link><pubDate>Wed, 04 Jun 2008 08:55:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8572789</guid><dc:creator>mohan_m</dc:creator><description>&lt;p&gt;I have target system (WinCE 5.0) in which Suspend/Wakeup works if the &amp;nbsp;WinCE GUI Shell is included on PB OSDesign.&lt;/p&gt;
&lt;p&gt;Without the WinCE GUI shell, the system always does a Cold Boot start. Any thing I should look for.?&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#8616345</link><pubDate>Wed, 18 Jun 2008 16:00:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8616345</guid><dc:creator>selmaguzel</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;How can I turn the screen off in c#?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#8620584</link><pubDate>Thu, 19 Jun 2008 10:01:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8620584</guid><dc:creator>selmaguzel</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Firts I must say that I suppose&lt;/p&gt;
&lt;p&gt;POWER_STATE_IDLE &amp;nbsp;mode is not valid for my sbc:arm9 based qq2440.Because when i use POWER_STATE_SUSPEND,&lt;/p&gt;
&lt;p&gt;the system replies,but using POWER_STATE_IDLE i don't get result as screen off.&lt;/p&gt;
&lt;p&gt;Now, my question is how the system gets through the POWER_STATE_ON state when a user touches the screen again.&lt;/p&gt;
&lt;p&gt;Namely i should ask how the system gets events when it is on suspend mode?&lt;/p&gt;
&lt;p&gt;Thanks in advance.&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#8621676</link><pubDate>Thu, 19 Jun 2008 16:30:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8621676</guid><dc:creator>selmaguzel</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;In fact i want to set all the things from platform builder, namely the time for getting through the screen off mode and then when user touches the screen again on mode.&lt;/p&gt;
&lt;p&gt;Is it possible?&lt;/p&gt;
&lt;p&gt;I suppose it can be if i set somethings in the source code of the pm driver or the PWRBTN_PCF driver(the pm driver in the sbc's bsp)?&lt;/p&gt;
&lt;p&gt;Thanks in advance.&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#8662200</link><pubDate>Fri, 27 Jun 2008 20:01:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8662200</guid><dc:creator>Jim Peternel</dc:creator><description>&lt;p&gt;I'm working with a USB device connected to a WM 5.0 terminal. &amp;nbsp;I've found that the terminal does not consider USB traffic when determining if the terminal is idle. &amp;nbsp;So what happens is, I'm sending data in thru the USB port and the terminal goes to sleep. &amp;nbsp;I've not found the PowerPolicyNotify to work for this case. &amp;nbsp;I also can't seem to get the PPN(false) call to work. &amp;nbsp;It seems to hang up.&lt;/p&gt;
&lt;p&gt;[DllImport(&amp;quot;coredll.dll&amp;quot;, CharSet = CharSet.Unicode)]&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public static extern bool PowerPolicyNotify(int dwMessage, int dwData);&lt;/p&gt;
&lt;p&gt;bool bStatus = PowerPolicyNotify((int)PPN_Message.PPN_UNATTENDEDMODE, 0);&lt;/p&gt;
</description></item><item><title>re: Power to the System</title><link>http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx#9050174</link><pubDate>Thu, 06 Nov 2008 21:43:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9050174</guid><dc:creator>Marco</dc:creator><description>&lt;p&gt;I'm developing a WM 6.1 device and my power button device driver calls PowerPolicyNotify(PPN_POWERBUTTONPRESSED, 0);, so the device normally goes to suspend and when the device is in the ScreenOff state its lcd/backlight turns on.&lt;/p&gt;
&lt;p&gt;I'd like to add an optional behavior to my device through a dedicated configuration in the user interface.&lt;/p&gt;
&lt;p&gt;That is I'd like that optionally pressing the power button it puts the device into the ScreenOff state instead of the Suspend state.&lt;/p&gt;
&lt;p&gt;Do I have to change my power button device driver or does it exist an alternative way?&lt;/p&gt;
&lt;p&gt;does a registry key exist to get this type of behavior?&lt;/p&gt;
&lt;p&gt;How can I associate the power state transitions (i.e. from On to ScreenOff) and the power events (i.e. like power button pressure) ?&lt;/p&gt;
&lt;p&gt;thank you!!&lt;/p&gt;
&lt;p&gt;Marco&lt;/p&gt;
</description></item></channel></rss>