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" <(E-Mail Removed)> wrote in message
news:%23$(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:F8294B34-062F-45FE-9F1E-(E-Mail Removed)...
>> 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
>
>