Automatically Installing or Running an Application on a Storage Card
The Auto-run feature enables Pocket PC software to detect a storage card that has been inserted into Pocket PC, and to automatically load a specified application from the storage card into active memory. Auto-cleanup causes Pocket PC to detect removal of the storage card and instructs the application to perform cleanup and to remove itself from active memory.
To take advantage of Auto-run and Auto-cleanup, add the following directory structure and files to a storage card:
Root\...\2577\autorun.exe
When a user inserts a storage card, Microsoft Windows for Pocket PC searches the root directory of the card for a directory with the same name as the processor for that device. On Pocket PC 2002 and later devices, which are ARM based, this directory will always be called 2577 — the processor type for ARM. The software then searches this directory for the Autorun.exe file and loads this file to the \Windows directory in main memory on Pocket PC. Finally, the shell invokes the copy of Autorun.exe on the device by using the install parameter. When the user removes the card, the shell invokes Autorun.exe by using the uninstall parameter. The software will also detect if a card is inserted, removed, or swapped while power is off, and will take appropriate action as soon as the device is turned on.
For example, a game developer can store game binaries and data files on a storage card. The developer can then design an Autorun.exe file to add registry settings and load necessary files when the storage card is inserted into Pocket PC, and to remove these settings and files when the card is removed.
In an enterprise application, Auto-run could be used to deploy a custom software application and data to a large number of devices. Updates to the application could be distributed to remote employees on inexpensive, low-capacity storage cards that perform automatic and trouble-free installation when inserted into Pocket PC devices. If users must cold boot or replace their devices, they can simply insert the Auto-run storage card that contains the application and data and return to work.
Programmers can determine which directory Auto-run is using as its source for the Autorun.exe file by using the SHGetAutoRunPath function. This function will search for the first storage card and construct the path that would be used to look for an Auto-run file. A storage card must be inserted for this function to succeed, although it is not necessary that an Auto-run file or directory actually be present on the storage card.
就是说,如果你用的是Pocket PC 2003,那么就在存储卡上建个2577目录,然后把你要自动运行的程序改成autorun.exe,放到这个目录下