How to detect from PPC when ActiveSync is connected

  • Thread starter Thread starter Tihomir Ignatov
  • Start date Start date
T

Tihomir Ignatov

Hello,
How can I detect from my device when Activesync is connected?

Tihomir
 
Tihomir said:
Hello,
How can I detect from my device when Activesync is connected?

Tihomir

try checking the IP address for PPP_PEER

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
 
Back
Top