views:

154

answers:

3

Hi

How to identify that Terminal (Windows Mobile 2005 ) connect to cradle ?

I need to identical in the Terminal

thank's in advance

+2  A: 

If you are checking from the host (desktop), there are 2 ways I know of: via a process trigger and via a COM interface.

  1. AutoStartOnConnect
    There's a registry key at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services called AutoStartOnConnect. Or of course you could use a similar value at HKEY_CURRENT_USER. Install a string value under that key, with any name. The Data for that value ought to be the command line of an application to run when the device connects. If you wish to notify an application that is already running, you could write a small exe that notifies your running app that the device has connected. Insert the path to that small exe into the Value under the AutoStartOnConnect key.
  2. IDccMan / IDccManSink
    Your app can register a COM object on the desktop that gets invoked for various device events. This will require P/Invoke and interop, but it's not too tricky. The openNETCF source code includes C# wrappers for these interfaces.
Cheeso
+1  A: 

You could use RAPI. Have a look at RAPI communication library at OpenNETCF. This helps if you are testing from the host's side.

kgiannakakis
+3  A: 

If you need to do it from the device:

static public bool IsConnectedToCradle
{
  get { return SystemState.CradlePresent; }
}

PS: FWIW, in Windows Mobile terminology, the 'terminal' is usually called the 'device'.

Serge - appTranslator