Re: Checking if device is docked - please help
- From: "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com>
- Date: Thu, 8 Nov 2007 08:20:41 -0700
If you resolve PPP_PEER on any version of Windows Mobile, I think you should
get something if you are docked, and nothing if you are not.
Paul T.
"Christian Resma Helle" <xtianism@xxxxxxxxx> wrote in message
news:%23$jwe3eIIHA.5360@xxxxxxxxxxxxxxxxxxxxxxx
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: How can I broadcast a WakeOnLan datapacket?
- Next by Date: Re: Device won't idle time out when my app is running
- Previous by thread: Re: Checking if device is docked - please help
- Next by thread: Re: Checking if device is docked - please help
- Index(es):
Relevant Pages
|
Loading