Connected: Difference between revisions
Jump to navigation
Jump to search
(remove link spam) |
m (BrokenLinks: Samples, ...) |
||
Line 1: | Line 1: | ||
Back to [[Samples]] | [[Category:Samples]] | ||
Back to [[:Category:Samples|Samples]]<!-- look at possible separate samples page --> | |||
'''Purpose:''' | '''Purpose:''' | ||
Line 11: | Line 12: | ||
* How to use BitAND to interpret binary flags. | * How to use BitAND to interpret binary flags. | ||
<syntaxhighlight lang="autoit"> | |||
;-------------------------------------------------------------------------------------------- | ;-------------------------------------------------------------------------------------------- | ||
;check $ret[0] for trueness, and $ret[1] for type of connection according to variables provided... | ;check $ret[0] for trueness, and $ret[1] for type of connection according to variables provided... | ||
Line 39: | Line 41: | ||
MsgBox(4096,$ret[0] & ":" & $ret[1],$sX) | MsgBox(4096,$ret[0] & ":" & $ret[1],$sX) | ||
</syntaxhighlight> | |||
Latest revision as of 13:34, 17 November 2012
Back to Samples
Purpose:
Check your internet connectivity.
Illustrates:
- How to use DllCall.
- How to use BitAND to interpret binary flags.
;--------------------------------------------------------------------------------------------
;check $ret[0] for trueness, and $ret[1] for type of connection according to variables provided...
;--------------------------------------------------------------------------------------------
$INTERNET_CONNECTION_MODEM = 0x1
$INTERNET_CONNECTION_LAN = 0x2
$INTERNET_CONNECTION_PROXY = 0x4
$INTERNET_CONNECTION_MODEM_BUSY = 0x8
$INTERNET_RAS_INSTALLED = 0x10
$INTERNET_CONNECTION_OFFLINE = 0x20
$INTERNET_CONNECTION_CONFIGURED = 0x40
$ret = DllCall("WinInet.dll","int","InternetGetConnectedState","int_ptr",0,"int",0)
If $ret[0] then
;check type of connection
$sX = "Connected !" & @LF & "------------------" & @LF
If BitAND($ret[1], $INTERNET_CONNECTION_MODEM) Then $sX = $sX & "MODEM" & @LF
If BitAND($ret[1], $INTERNET_CONNECTION_LAN) Then $sX = $sX & "LAN" & @LF
If BitAND($ret[1], $INTERNET_CONNECTION_PROXY) Then $sX = $sX & "PROXY" & @LF
If BitAND($ret[1], $INTERNET_CONNECTION_MODEM_BUSY) Then $sX = $sX & "MODEM_BUSY" & @LF
If BitAND($ret[1], $INTERNET_RAS_INSTALLED) Then $sX = $sX & "RAS_INSTALLED" & @LF
If BitAND($ret[1], $INTERNET_CONNECTION_OFFLINE) Then $sX = $sX & "OFFLINE" & @LF
If BitAND($ret[1], $INTERNET_CONNECTION_CONFIGURED) Then $sX = $sX & "CONFIGURED" & @LF
Else
$sX = "Not Connected"
Endif
MsgBox(4096,$ret[0] & ":" & $ret[1],$sX)