mobile databases, mobile forms, and mobile synchronization … where you need to work
Providing Pocket Access, Mobile Database, Windows CE Database, and Windows CE Development Solutions

Tip of the Month (April 2008)

Starting a Desktop Application When a Handheld Connects

When you connect a handheld to the desktop, our synchronizer knows to start synchronizing if you have "Synchronize on Connect" turned on. If you want something else done when a connection is made, here's how to set that up.

First, it will be helpful to know how we manage to convince ActiveSync (a.k.a. Mobile Device Center) to launch our synchronizer.

Our synchronizer is an executable program. It's called VICESYNC.EXE and it is usually installed in C:\Program Files\Windows CE Services\SYWARE Visual CE\VICESYNC.EXE. If you connected the handheld to the desktop, navigated to VICESYNC.EXE on the desktop, and double clicked it, you would notice that the Visual CE synchronizer starts.

Convincing ActiveSync to launch us is actually pretty straight forward. Using the registry editor, go to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows CE Services\AutoStartOnConnect and you will see a string value called VisualCEConect whose value is the full pathname of VICESYNC.EXE. If you want ActiveSync to run your executable, just create another string value (it doesn't matter what it is called) whose value is the full pathname of the executable you want to run.

Knowing all this, you can do some clever things. For example:

  • If youare sure that Visual CE syncronization never takes more than a minute, you can have ActiveSync launch an application that sleeps for a minute and then does something you need to have done after the Visual CE synchronization completes.
  • If you want to do something after the handheld disconnects, there is a registry entry HKEY_LOCAL_MACHINE\Software\Microsoft\Windows CE Services\AutoStartOnDisconnect that works just the way you would expect it to.
  • You can remove the VisualCEConnect entry and replace it with your own executable...and your own executable could do some pre-processing, launch VICESYNC.EXE and wait for it to complete, and then do some post-processing.

Of course, to take advantage of all this, you will need the services of a programmer to create the executable to run. If you have someone in house to do this, you are all set. If not, contact us and we'll see what we can do for you.


Previous Tips of the Month