procedure CheckConnection; var dwFlags: DWORD; begin if InternetGetConnectedState(@dwFlags, 0) then begin if (dwFlags and INTERNET_CONNECTION_MODEM)=INTERNET_CONNECTION_MODEM then ShowMessage('Connected through modem') else if (dwFlags and INTERNET_CONNECTION_LAN) = INTERNET_CONNECTION_LAN then ShowMessage('Connected through LAN') else if (dwFlags and INTERNET_CONNECTION_PROXY) = INTERNET_CONNECTION_PROXY then ShowMessage('Connected through Proxy') else if (dwFlags and INTERNET_CONNECTION_MODEM_BUSY) = INTERNET_CONNECTION_MODEM_BUSY then ShowMessage('Modem is busy'); end else ShowMessage('Offline'); end; //don't forget uses WinInet;
关键字词: