[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState( out int connectionDescription, int reservedValue ) ;

/// <summary>
/// Retrieves the connected state of the local system.
/// </summary>
/// <returns>Returns True if there is an Internet connection, or False otherwise.</returns>
public bool IsConnected()
{
    
int connectionDescription = 0;
    
return InternetGetConnectedState(out connectionDescription, 0);
}

References:
Microsoft Offline Application Block
WinINetDetectionStrategy.cs

相关文章:

  • 2021-07-01
  • 2021-09-26
  • 2022-12-23
  • 2021-05-29
  • 2021-08-04
  • 2021-10-04
  • 2022-02-15
猜你喜欢
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2021-10-23
  • 2022-12-23
相关资源
相似解决方案