poekid88

how can i do that

tried alot of methods online but is mostly for windows mobile...not pocket PC....

tried system.status, but dunno y got the "WindowsMobile.Utilities" not found exception...

Hope some1 can reply soon...lol



Re: .NET Compact Framework Checking programatically if POCKET PC is cradled ??

Christopher Fairbairn

Hi,

Losely speaking Windows Mobile is simply later editions of Pocket PC.

If you are using a Windows Mobile 2005 (or higher) device you should be able to use the following code to detect the presence of a cradle (don't forget to include references to Microsoft.WindowsMobile and Microsoft.WindowsMobile.Status assemblies).

using Microsoft.WindowsMobile.Status;

if (SystemState.CradlePresent)

MessageBox.Show("Cradle is present");

else

MessageBox.Show("Cradle is not present");

This property is documented on MSDN here http://msdn2.microsoft.com/en-us/library/microsoft.windowsmobile.status.systemstate.cradlepresent.aspx

If you are using a pre Windows Mobile 2005 device the situation is a little more tricky, as far as I am aware there is no officially documented technique to detect the situation, except for things such as using CeRunAppAtEvent (http://msdn2.microsoft.com/en-us/library/ms913956.aspx) to wake your application when the NOTIFICATION_EVENT_RS232_DETECTED event occurs and this is not as neat as simply querying a boolean property.

There is a good forum posting on this second technique including ways to call this API from C# or VB.NET available here http://www.opennetcf.org/forums/topic.asp TOPIC_ID=783. This post also includes references to a pre-written wrapper available as part of OpenNETCF

MSDN also contains an article which contains a wrapper for this function to detect activesync syncronisations available here http://msdn2.microsoft.com/en-us/library/aa446536.aspx.

Thanks,

Christopher Fairbairn






Re: .NET Compact Framework Checking programatically if POCKET PC is cradled ??

Saravanan V V

hi

You can do this by monitoring the following registry entry.
HKLM\System\State\Hardware\Cradled

When the Cradled entry is 1 then the device is cradled if it is 0 then the device is not cradled






Re: .NET Compact Framework Checking programatically if POCKET PC is cradled ??

Christopher Fairbairn

Hi,

As far as I am aware this registry key is only supported on Windows Mobile 5.0 or above devices.

I am assuming the reason why the original poster is getting an ""WindowsMobile.Utilities" not found exception, is because they are using a pre Windows Mobile 2005 device, and hence this registry key will not be present.

Thanks,

Christopher Fairbairn






Re: .NET Compact Framework Checking programatically if POCKET PC is cradled ??

Russ Ryba

Personally I've always checked the IP address. Write a tiny utility to display the IP addresses of the local machine. Desktop code works just fine on the handheld.

I believe you'll see your IP address is
192.168.55.100 or 192.168.55.101... can't recall right now. One is the desktop, the other is the pc. ActiveSync v4 those numbers changed to something else. This requires that ActiveSync is configured to allow IP pass through which is enabled by default.

I've used this from PocketPC to Windows Mobile 5 in eVB and C#/VB.NET without any reported problems.


If you need similar the PC to be in control you can add the registry entry for AutoStartOnConnect and create a desktop control program to launch a program on the handheld device using RAPI.

I'll leave it to you to search for ActiveSync AutoStartOnConnect and how to resolve an IP address using whatever language you're using.


Cheers,
- Russ Ryba