Saturday, April 7, 2007

Windows CE > How to Auto Run an application after bootup

1) In our example we will get Platform Settings (MyConfigurator.exe) to Auto Run as soon as our system boots
2) There are two ways to get the application to run depending on at what point you want the application to run.
a. Before anything else runs (ie. explorer)
b. After system has settled at the desktop.

*Before Anything else runs:
· Open platform.reg and add the following line:


[HKEY_LOCAL_MACHINE\init]
"Launch50"="MyConfigurator.exe"
"Depend50"=hex:14,00,1E,
Save the changes and exit. The LaunchXX key (where XX is a numeric value) simply points at the executable to launch and gives it it’s order (50 is usually explorer.exe). In the above case, the registry launches three processes, Shell, Device, and GWES. Device.exe (Launch20) has a dependency on Hex:0a (10 decimal). This equates to Launch10, or shell.exe, so the Shell process needs to signal the operating system that it's up and running so that any dependencies (in this case device.exe) can then be started. The same is also true of gwes.exe (launch30), device.exe depends on hex:14 (20 decimal), so GWES can't run until device.exe calls SignalStarted.
You can have multiple dependencies; for our case the dependencies will be on hex:14,00,1e,00 (Launch20 and Launch30), so both Device and GWES need to be up and running before the shell starts.
Go back to workspace that will have the Auto Run application added and select “Make Run-Time Image from the Build OS drop down menu.
* After system has settled at the desktop
· You simply need to change the code previously added in the platform.reg file to the following:

[HKEY_LOCAL_MACHINE\init]
"Launch79"="MyConfigurator.exe"
"Depend79"=hex:14,00,1E,00

· The above entry will no longer override the launch number that is originally used by explorer.exe and launch the application with the same dependencies as our example seen in “Before anything else runs”.

1 comment:

jp2code said...

I don't really understand. Your numbers in the examples don't really match your explanations. Did you edit the values at some point and not update the explanations in the text?