DotNetMania,
You can call the InternetGetConnectedStateEx function in the WinInet
library through the P/Invoke layer to do this. You can use this code:
[DllImport("WinInet.dll", CharSet=CharSet.Auto)]
public static extern bool InternetGetConnectedStateEx(
[MarshalAs(UnmanagedType.U4)] int lpdwFlags,
StringBuilder lpszConnectionName,
[MarshalAs(UnmanagedType.U4)] int dwNameLen,
[MarshalAs(UnmanagedType.U4)] int dwReserved);
You can get the values to pass in from the documentation for this
function.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"DotNetMania" <km*****@msn.com> wrote in message
news:eu**************@tk2msftngp13.phx.gbl...
when i want to know internet connection i use below code ..
WebRequest Request = WebRequest.Create(new Uri( HOME ));
if (Request.GetResponse().ToString().Length > 0)
{
result = true;
}
but this code is so delay..
are there the other method to solve this problem..?