diff --git a/Contrib/Dialer/Dialer.txt b/Contrib/Dialer/Dialer.txt index 2a95a6cc..7e067d76 100644 --- a/Contrib/Dialer/Dialer.txt +++ b/Contrib/Dialer/Dialer.txt @@ -21,6 +21,44 @@ IfErrors "" +3 ;Check for errors Pop $R0 ;Get the return value from the stack MessageBox MB_OK $R0 ;Display the return value +EXAMPLE 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 ;Remove to make error not fatal + + noie3: + + ; IE3 not installed + MessageBox MB_OK|MB_ICONINFORMATION "Please connect to the internet now." + + connected: + + Pop $R0 + +FunctionEnd + FUNCTIONS --------- diff --git a/Contrib/NSIS Update/NSISUpdate.nsi b/Contrib/NSIS Update/NSISUpdate.nsi index 28a8aa7f..04ca30a2 100644 --- a/Contrib/NSIS Update/NSISUpdate.nsi +++ b/Contrib/NSIS Update/NSISUpdate.nsi @@ -280,22 +280,26 @@ Function CloseMenu FunctionEnd Function ConnectInternet + + Push $R0 - ClearErrors - Dialer::AttemptConnect - IfErrors noie3 + ClearErrors + Dialer::AttemptConnect + IfErrors noie3 + Pop $R0 + StrCmp $R0 "online" connected + MessageBox MB_OK|MB_ICONSTOP "Cannot connect to the internet." + Quit + + noie3: + + # IE3 not installed + MessageBox MB_OK|MB_ICONINFORMATION "Please connect to the internet now." + + connected: + Pop $R0 - StrCmp $R0 "online" connected - MessageBox MB_OK|MB_ICONSTOP "Cannot connect to the internet." - Quit - - noie3: - - # IE3 not installed - MessageBox MB_OK|MB_ICONINFORMATION "Please connect to the internet now." - - connected: FunctionEnd diff --git a/Docs/src/usefulfunc.but b/Docs/src/usefulfunc.but index f4b671af..75cf869e 100644 --- a/Docs/src/usefulfunc.but +++ b/Docs/src/usefulfunc.but @@ -521,7 +521,44 @@ \c \c SetOverwrite on \c -\c !macroend +\c !macroend\ + +\H{connectinternet} Connect to the internet + +\c ; ConnectInternet (uses Dialer plugin) +\c ; Written by Joost Verburg +\c ; +\c ; This function attempts to make a connection to the internet if there is no +\c ; connection available. If you are not sure that a system using the installer +\c ; has an active internet connection, call this function before downloading +\c ; files with NSISdl. +\c ; +\c ; The function requires Internet Explorer 3, but asks to connect manually if +\c ; IE3 is not installed. +\c +\c Function ConnectInternet +\c +\c Push $R0 +\c +\c ClearErrors +\c Dialer::AttemptConnect +\c IfErrors noie3 +\c +\c Pop $R0 +\c StrCmp $R0 "online" connected +\c MessageBox MB_OK|MB_ICONSTOP "Cannot connect to the internet." +\c Quit ;Remove to make error not fatal +\c +\c noie3: +\c +\c ; IE3 not installed +\c MessageBox MB_OK|MB_ICONINFORMATION "Please connect to the internet now." +\c +\c connected: +\c +\c Pop $R0 +\c +\c FunctionEnd \H{morefuncs} More diff --git a/Examples/waplugin.nsi b/Examples/waplugin.nsi index 5a3283c0..f1b6b507 100644 --- a/Examples/waplugin.nsi +++ b/Examples/waplugin.nsi @@ -169,22 +169,26 @@ Function MakeSureIGotWinamp FunctionEnd Function ConnectInternet + + Push $R0 - ClearErrors - Dialer::AttemptConnect - IfErrors noie3 + ClearErrors + Dialer::AttemptConnect + IfErrors noie3 + Pop $R0 + StrCmp $R0 "online" connected + MessageBox MB_OK|MB_ICONSTOP "Cannot connect to the internet." + Quit + + noie3: + + ; IE3 not installed + MessageBox MB_OK|MB_ICONINFORMATION "Please connect to the internet now." + + connected: + Pop $R0 - StrCmp $R0 "online" connected - MessageBox MB_OK|MB_ICONSTOP "Cannot connect to the internet." - Quit - - noie3: - - ; IE3 not installed - MessageBox MB_OK|MB_ICONINFORMATION "Please connect to the internet now." - - connected: FunctionEnd