According to WMPowerUser and IStartedSometing.com there may be a Windows Mobile store coming to WM7 devices. If you are a developer now would be the time to begin writing programs for such a store. If it comes into existence then you’ll have apps ready to be first to market. If not then you can still sell them through other online sites.
I see this time and time again. It’s a practice that you don’t want to do in a a mobile program or any other program for that matter. In multithread programming a deveoper will sometimes want to stop execution of a thread until a certain event occurs or some other task is complete and will write something like the following to halt execution.
//Do nothing here
The problem with this code is it unnecessarily uses CPU bandwidth. Most desktop applications spend a majority of their time waiting on some event to occur (waiting on a user to press a key, waiting on a file to load, waiting on a network event to happen). When the above code is used the CPU is burning cycles when it could have been halted waiting for something to occur or giving up those cycles to another more constructive task. On a Windows Mobile device this type of coding pattern will lead to the CPU not going into a lower power state when it could and unnecessarily causes power to be asserted across the memory bus.
Instead of using the above pattern you could join threads (which will cause one thread to wait for another to finish executing) or use events, mutexes, and semaphores to block a thread until it is signaled by another thread to continue. Within the course of the next few weeks I will cover some of these techniques. In the mean time you may wish to read the article I published on Power Management.
I’ve taken the discussion of the power button and have expanded upon it in the form of an article on power management in Widnows Mobile devices. I’ve published it at my favorite online dev community site, codeproject.com. Go over to http://www.codeproject.com/script/Articles/Article.aspx?aid=28886 and take a look at the article. If you find the information useful then please log in and rate it!
I had to pull out one of my older Pocket PCs for testing something and while I was at it I decided to round up my Windows CE devices and take a picture of them together. I seem to have quite a bit. Missing from the history of devices that I’ve owned are an i-mate Jam and the ViewSonic V37. Regretably I sold one and gave the other to some one that wanted a PocketPC. I hope to get a Windows Mobile 6 standard device and a Windows CE development kit in the coming months.
The impact of unobservable events has long been a subject over which humans have pondered. Some questions are either well known or commonly shared.
- If a tree falls in the forest and no one hears it then does it make a sound?
- When I close the door on the fridge does the light go out?
- Is Schrodinger’s cat dead or alive?
- When I press the power button on my Windows Mobile phone do the programs stop running?
These are all questions will all be answered by the end of this blog post. Thanks to the availability of inexpensive electronics such as digital video and audio recorders we can show that falling tress make noises and that the lights in the fridge do go out. Figuring out what happens when the power button is pressed on Windows Mobile was a little more difficult.
My first attempt at answering this question was based on programs that changed what they were displaying over their execute cycles. If the Windows Mobile device suspends when I press the power button then after pressing the button, waiting a few seconds, and pressing it again the program’s display should show the same thing that it did before I pressed the button. If the device continues to run when I press the power button then after the test I should see something that is noticeably different. I ran my test and concluded that the processor continued to run after the power button was pressed. As it turned out my initial conclusion was wrong.
After performing much more research on the matter I found that my conclusion contradicted other material I found such as the “Power to the Programmers” post on the Windows Mobile Team Blog. I performed my tests again and increased the amount of time that I left the device in its alleged suspended state. After successive test I achieved enlightenment. Pressing the power button on a Windows Mobile Professional device powers down the display and some other hardware, but the processor continues to run. After a certain amount of time has passed unless a program has indicated a desire to do otherwise the device’s processor will halt until something wakes it up. When the device is in this state it’s not off; the programs are still in memory. Windows Mobile Standard devices are always on, there’s no questioning that.
In a forthcoming post I’ll cover the details of power control on Windows Mobile devices.
So the only question that leaves open is whether or not Schrodinger’s cat is alive. I will leave that question unanswered and hope for the best for his cat.
One of the things that I love about Microsoft is that once you learn a Microsoft technology parts of it are transferable to other Microsoft Platforms. The .Net technologies are an excellent example of this. There’s also DirectX (portions of which can be used on Windows Mobile devices) and MFC.
Another such technology is MFC (Microsoft Foundation Classes). MFC is a library of C++ application framework library for creating Windows applications. It is a native code library, so you have full access to the native API without the need of platform invoke declarations or re-declaring structures for making native calls. But it also provides several high level classes for creating UI elements and responding to windows messages. I would say that MFC lives half way between .Net based programs and traditional native non-MFC applications.
I am engaging in a project for which it will be easier to use native code. The project is going to rely on some third party native code libraries with a massive amount structures. For the first phase of this project I plan to use MFC so that I can make a prototype with the third party library. Later on I will make an abstraction layer that gives simpler access to the functionality that I need and then I will create a .Net wrapper for it. In the coming weeks once the project reaches a certain level of functionality, stability, and presentability I’ll be posting the code on CodeProject.com. I don’t want to say anything about the nature of the project just yet, but I’m sure it will be very popular!