How to Check when a computer is connected to internet
-
I read about wininet.dll, but i'd like to know if a computer is connected as soon as is connected, how can i know it? i thought using a timer, but i don't think it's a good idea..
Hope following helps you //Creating the extern function... [DllImport("wininet.dll")] private extern static bool InternetGetConnectedState( out int Description, int ReservedValue ) ; //Creating a function that uses the API function... public static bool IsConnectedToInternet( ) { int Desc = 0 ; return InternetGetConnectedState( out Desc, 0 ) ; }
- ashish
-
Hope following helps you //Creating the extern function... [DllImport("wininet.dll")] private extern static bool InternetGetConnectedState( out int Description, int ReservedValue ) ; //Creating a function that uses the API function... public static bool IsConnectedToInternet( ) { int Desc = 0 ; return InternetGetConnectedState( out Desc, 0 ) ; }
- ashish