I have written several posts about starting an application when a Windows CE device boots. These posts have been fairly popular, but there are still some questions. The how to posts include:
Here are some of the questions that I have received about starting applications when the system boots:
This is not an uncommon problem. For this discussion, let’s assume that the application is where you put it and that you correctly added it to the Init key. The usual problem is that your application is dependent on something that is not yet ready. Starting an application as soon as the system boots is different than running it later. The application must ensure that the APIs that it needs are ready to be used and that the drivers and disks that it needs are ready.
To determine if an API is ready to be used, you can use IsAPIReady() but it is recommended that this function be replace with OpenEvent() and WaitForSingleObject(), or for Windows CE 6.0 and beyond WaitForAPIReady().
The problem here is that if the card isn’t mounted by the time that Filesys tries to launch the application, the application won’t load. The solution is to include an application that can run early and monitor for the card to be mounted, then run your application from SD.
The problem here is that the \Windows folder is in RAM, so a reset or power loss will delete any files that you put into it. So now we need to look to see if your changes to the Init key persisted through the reset or power loss. If it did, then there must be some persistent storage on the device, so figure out where that is and put your application there. If you do this, you may also need to change the system path which I covered in
Windows CE: Setting the System Path.
If the system that you are using doesn’t have a persistent disk, then you really should pick a different system if you want to start an application when the system boots.
Copyright © 2009 – Bruce Eitman
All Rights Reserved