Detect an internet connection activation with Delphi

后端 未结 4 508
不思量自难忘°
不思量自难忘° 2020-12-01 05:45

I\'ve been using a 3G wireless card for a while and every time I connect, my anti-virus fires up the updates.

I\'m wondering what is the Win32 API set of functions t

4条回答
  •  臣服心动
    2020-12-01 06:25

    uses WinInet;
    
    function IsConnected: boolean;
    const
      // local system uses a modem to connect to the Internet.
      INTERNET_CONNECTION_MODEM      = 1;
      // local system uses a local area network to connect to the Internet.
      INTERNET_CONNECTION_LAN        = 2;
      // local system uses a proxy server to connect to the Internet.
      INTERNET_CONNECTION_PROXY      = 4;
      // local system's modem is busy with a non-Internet connection.
      INTERNET_CONNECTION_MODEM_BUSY = 8;
    
    var
      dwConnectionTypes : DWORD;
    begin
      dwConnectionTypes := INTERNET_CONNECTION_MODEM +
                           INTERNET_CONNECTION_LAN +
                           INTERNET_CONNECTION_PROXY;
      Result := InternetGetConnectedState(@dwConnectionTypes,0);
    end;
    

提交回复
热议问题