| 1 |
DIALER PLUGIN |
| 2 |
------------- |
| 3 |
|
| 4 |
Written by Amir Szekely aka KiCHiK |
| 5 |
Readme by Joost Verburg |
| 6 |
|
| 7 |
The Dialer plugin for NSIS provides five functions related to internet connections. |
| 8 |
|
| 9 |
To download files from the internet, use the NSISdl plugin. |
| 10 |
|
| 11 |
USAGE |
| 12 |
----- |
| 13 |
|
| 14 |
Example of usage: |
| 15 |
|
| 16 |
ClearErrors ;Clear the error flag |
| 17 |
Dialer::FunctionName ;Call Dialer function |
| 18 |
IfErrors "" +3 ;Check for errors |
| 19 |
MessageBox MB_OK "Function not available" |
| 20 |
Quit |
| 21 |
Pop $R0 ;Get the return value from the stack |
| 22 |
MessageBox MB_OK $R0 ;Display the return value |
| 23 |
|
| 24 |
EXAMPLE FUNCTION |
| 25 |
---------------- |
| 26 |
|
| 27 |
; ConnectInternet (uses Dialer plugin) |
| 28 |
; Written by Joost Verburg |
| 29 |
; |
| 30 |
; This function attempts to make a connection to the internet if there is no |
| 31 |
; connection available. If you are not sure that a system using the installer |
| 32 |
; has an active internet connection, call this function before downloading |
| 33 |
; files with NSISdl. |
| 34 |
; |
| 35 |
; The function requires Internet Explorer 3, but asks to connect manually if |
| 36 |
; IE3 is not installed. |
| 37 |
|
| 38 |
Function ConnectInternet |
| 39 |
|
| 40 |
Push $R0 |
| 41 |
|
| 42 |
ClearErrors |
| 43 |
Dialer::AttemptConnect |
| 44 |
IfErrors noie3 |
| 45 |
|
| 46 |
Pop $R0 |
| 47 |
StrCmp $R0 "online" connected |
| 48 |
MessageBox MB_OK|MB_ICONSTOP "Cannot connect to the internet." |
| 49 |
Quit ;Remove to make error not fatal |
| 50 |
|
| 51 |
noie3: |
| 52 |
|
| 53 |
; IE3 not installed |
| 54 |
MessageBox MB_OK|MB_ICONINFORMATION "Please connect to the internet now." |
| 55 |
|
| 56 |
connected: |
| 57 |
|
| 58 |
Pop $R0 |
| 59 |
|
| 60 |
FunctionEnd |
| 61 |
|
| 62 |
FUNCTIONS |
| 63 |
--------- |
| 64 |
|
| 65 |
If a function is not available on the system, the error flag will be set. |
| 66 |
|
| 67 |
* AttemptConnect |
| 68 |
|
| 69 |
Attempts to make a connection to the Internet if the system is not connected. |
| 70 |
|
| 71 |
online - already connected / connection successful |
| 72 |
offline - connection failed |
| 73 |
|
| 74 |
Requires Internet Explorer 3 or later |
| 75 |
|
| 76 |
* AutodialOnline |
| 77 |
|
| 78 |
Causes the modem to automatically dial the default Internet connection if the system |
| 79 |
is not connected to the internet. If the system is not set up to automatically |
| 80 |
connect, it will prompt the user. |
| 81 |
|
| 82 |
Return values: |
| 83 |
|
| 84 |
online - already connected / connection successful |
| 85 |
offline - connection failed |
| 86 |
|
| 87 |
Requires Internet Explorer 4 or later |
| 88 |
|
| 89 |
* AutodialUnattended |
| 90 |
|
| 91 |
Causes the modem to automatically dial the default Internet connection if the system |
| 92 |
is not connected to the internet. The user will not be prompted. |
| 93 |
|
| 94 |
Return values: |
| 95 |
|
| 96 |
online - already connected / connection successful |
| 97 |
offline - connection failed |
| 98 |
|
| 99 |
Requires Internet Explorer 4 or later |
| 100 |
|
| 101 |
* AutodialHangup |
| 102 |
|
| 103 |
Disconnects an automatic dial-up connection. |
| 104 |
|
| 105 |
Return values: |
| 106 |
|
| 107 |
success - disconnection successful |
| 108 |
failure - disconnection failed |
| 109 |
|
| 110 |
Requires Internet Explorer 4 or later |
| 111 |
|
| 112 |
* GetConnectedState |
| 113 |
|
| 114 |
Checks whether the system is connected to the internet. |
| 115 |
|
| 116 |
Return values: |
| 117 |
|
| 118 |
online - system is online |
| 119 |
offline - system is offline |
| 120 |
|
| 121 |
Requires Internet Explorer 4 or later |