private static bool IsInCradle()
{
bool result = false;
try
{
// if the device is in the cradle and connected to ActiveSync
// then the desktop computer can be accessed using the hostname
// "PPP_PEER"
IPAddress nullAddress = new IPAddress(0);
IPHostEntry activeSync = Dns.GetHostByName("PPP_PEER");
if(activeSync != null)
{
for(int index=0; index < activeSync.AddressList.Length; index++)
{
if(activeSync.AddressList[index].Address != 0)
{
result = true;
break;
}
}
}
}
catch {}
return result;
}
On Windows Mobile 5.0, you can just query the SystemState.CradlePresent
property
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.