Connect to the internet: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Updated author and download links, and changed format of some pages.)
m (Updated author links.)
Line 1: Line 1:
{|align=right
|<small>Author: [[{{ns:2}}:joost|joost]] ([[{{ns:3}}:joost|talk]], [[{{ns:-1}}:Contributions/joost|contrib]])</small>
|}
<br style="clear:both;">
== Description ==
== Description ==
This function attempts to make a connection to the internet if there is
This function attempts to make a connection to the internet if there is
Line 42: Line 46:
  FunctionEnd
  FunctionEnd
</highlight-nsis>
</highlight-nsis>
Page author: [[User:joost|joost]]

Revision as of 23:15, 29 April 2005

Author: joost (talk, contrib)


Description

This function attempts to make a connection to the internet if there is no connection available.

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