Connect to the internet: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
(→Description: Updated information and links) |
|||
Line 5: | Line 5: | ||
no connection available. | no connection available. | ||
[https://web.archive.org/web/20050710024817/http://support.microsoft.com/kb/q242558/ Internet Explorer < v5 only reports the status of the default Internet connectoid]. If a nondefault connectoid is connected, InternetGetConnectedState always returns FALSE (unless a LAN connection is used). | |||
http:// | |||
On Windows Vista and later it is [https://web.archive.org/web/20120819160618/http://msdn.microsoft.com:80/en-us/library/windows/desktop/aa384702(v=vs.85).aspx#2 recommended] that you call INetworkListManager::GetConnectivity() instead. | |||
== The Function == | == The Function == |
Latest revision as of 17:35, 30 January 2019
Author: joost (talk, contrib) |
Description
This function attempts to make a connection to the internet if there is no connection available.
Internet Explorer < v5 only reports the status of the default Internet connectoid. If a nondefault connectoid is connected, InternetGetConnectedState always returns FALSE (unless a LAN connection is used).
On Windows Vista and later it is recommended that you call INetworkListManager::GetConnectivity() instead.
The Function
; ConnectInternet (uses Dialer plugin) ; Written by Joost Verburg ; ; This function attempts to make a connection to the internet if there is ; no connection available. If you are not sure that a system using the ; installer has an active internet connection, call this function before ; downloading files with NSISdl. ; ; The function requires Internet Explorer 3, but asks to connect manually ; if IE3 is not installed. Function ConnectInternet Push $R0 ClearErrors Dialer::AttemptConnect IfErrors noie3 Pop $R0 StrCmp $R0 "online" connected MessageBox MB_OK|MB_ICONSTOP "Cannot connect to the internet." Quit ;This will quit the installer. \ You might want to add your own error handling. noie3: ; IE3 not installed MessageBox MB_OK|MB_ICONINFORMATION \ "Please connect to the internet now." connected: Pop $R0 FunctionEnd