Determines whether the current user is connected to the Internet
#include <WinAPIDiag.au3>
_WinAPI_IsInternetConnected ( )
Success: | True - The user is connected to the Internet. False - Otherwise. |
Failure: | Sets the @error flag to non-zero, @extended flag may contain the HRESULT error code. |
This function requires Windows Vista or later.
Search IsInternetConnected in MSDN Library.
#include <MsgBoxConstants.au3>
#include <WinAPIDiag.au3>
#include <WinAPIDlg.au3>
#include <WinAPISys.au3>
If Number(_WinAPI_GetVersion()) < 6.0 Then
MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), 'Error', 'Require Windows Vista or later.')
Exit
EndIf
If _WinAPI_IsInternetConnected() Then
ConsoleWrite('Internet is already connected.' & @CRLF)
Exit
EndIf
; Launch the Get Connected wizard within the calling application to enable Internet connectivity
_WinAPI_GetConnectedDlg(1, 1 + 4)