Posts tagged ‘ActiveSync’

PC ActiveSync can be used to automate tasks on device connection

You can have several apps started every time a device connects via ActiveSync on your PC. To enable this, you have to enter the application(s) to start in your PC Windows registry:

REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\AutoStartOnConnect]
"OnConnect"="\"c:\\windows\\system32\\cmd.exe\" /c d:\\OnConnect\\install.bat"

In this example, the batch file d:\OnConnect\install.bat will be launched every time a device connects via ActiveSync. If you use the itsutils, you can specify a list of commands executed against the connected device. In example, you can use the following install.bat (assuming that all tools and files are in d:\OnConnect) ot alwayss install certain files onto the device.

@echo on                 
pause                      
d:
cd d:\OnConnect
pput -f -v _0000_comp_itcivacn2.cab "\DiskOnChip\Persistent Copy\CabFiles\_0000_comp_itcivacn2.cab"
pput -f -v userApp_WCE4.ARMV4.cab "\DiskOnChip\Persistent Copy\CabFiles\IuserApp_WCE4.ARMV4.cab"
pput -f -v sqlce.wce4.armv4.cab "\DiskOnChip\Persistent Copy\CabFiles\sqlce.wce4.armv4.cab"
pput -f -v System_SR_enu.cab "\DiskOnChip\Persistent Copy\CabFiles\System_SR_enu.cab"
pregutl @region.reg
pause "ReBoot ?"
preboot
pause "*************** Finished **************************"
exit

These line copy some files to the device, change the registry with a regedit4 conform file (download sample), sync the time of the device to yours PC time and then perform a warmboot. Using the XDA tools (itsutils) there are many more possibilities. Especially usefull, as PocketPC devices do not support batch files on the device.

Disable the ActiveSync Partnership setup dialog

If you are developing for windows mobile devices and got several devices, you may not want to be asked to setup a “New Partnership” on a new connected device.

To avoid partnering, you use a registry key and you will no more be asked to setup a partnership with your PocketPC or Windows CE device.

REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services]
“GuestOnly”=dword:00000001

To switch back to accepting partnerships, use this

REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services]
“GuestOnly”=dword:00000000