Steven
Wed Sep 10 17:39:20 CDT 2003
Hi,
I tried your solution. It seems to return the same Descrizione value of 18
whether my network card cable is connected or not. So, this doesn't help my
problem.
There must be some simple function that can determine if there is a live
network cable plugged into my network card. Any other suggestions?
Steve
"Andrea Zani" <andrew@aspitalia.com> wrote in message
news:bjo4e0$l8of0$3@ID-192116.news.uni-berlin.de...
> > Hi
> >
> > I need a code snippet to determine if my computer is connected to a
> network
> > or not.
> >
> > There's probably a System.Net function for it, but I cannot find it.
> >
> > Thanks,
> >
> > Steve
>
> Read this document:
>
http://www.mentalis.org/apilist/InternetGetConnectedState.shtml
>
> And read this example (author Cangiano):
>
> using System ;
> using System.Runtime ;
> using System.Runtime.InteropServices ;
>
> public class ConnectionState
> {
> [DllImport("wininet.dll")]
> private extern static bool InternetGetConnectedState( int out
> Description, int ReservedValue ) ;
>
> public static bool IsConnected( ){
> int Descrizione ;
> return InternetGetConnectedState( out Descrizione, 0 ) ;}
> }
>
> Bye
> --
> AZ
>
>