Re: Checking if device is docked - please help
- From: Rob S <RobS@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 8 Nov 2007 07:26:01 -0800
Thanks, that works perfectly.
"Christian Resma Helle" wrote:
If you're using Windows Mobile 5.0 or higher then you should check out the.
CradlePresent SystemState from the SNAPI (Microsoft.WindowsMobile.Status)
--
Regards,
Christian Resma Helle
http://christian-helle.blogspot.com
"Rob S" <RobS@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F8294B34-062F-45FE-9F1E-196E5E5C843A@xxxxxxxxxxxxxxxx
This is driving me mad, i'm using the below code:
public static bool IsDeviceDocked()
{
bool bRetVal = false;
try
{
string sHostName = Dns.GetHostName();
IPHostEntry ipheThisHost = Dns.GetHostByName(sHostName);
IPAddress ipThisAddr = ipheThisHost.AddressList[0];
string ip = ipThisAddr.ToString();
string localhost = IPAddress.Parse("127.0.0.1").ToString();
if (ip == localhost)
{
bRetVal = false;
}
else
{
bRetVal = true;
}
}
catch (Exception ex)
{
// TODO: Add your own exception handling here
}
return bRetVal;
}
Basically, if i start the application while it's docked then it returns
true
(as it should), if the application is started docked but then unplugged it
still returns true, if i start it unplugged then it returns false.
What is a reliable way of telling if it's docked or not? Nothing seems to
work for me.
Thanks guys
- References:
- Re: Checking if device is docked - please help
- From: Christian Resma Helle
- Re: Checking if device is docked - please help
- Prev by Date: Re: Device won't idle time out when my app is running
- Next by Date: Re: How can I broadcast a WakeOnLan datapacket?
- Previous by thread: Re: Checking if device is docked - please help
- Next by thread: Re: MS Access Database Connectivity For Win CE 6.0
- Index(es):