

My question to you is what is returning 0, the function or the parameter?msdn wrote:This parameter may return a valid flag even when the function returns FALSE.
Code: Select all
Debug InternetGetConnectedState_(@ics, 0)
Debug ics
Code: Select all
; HowIsInternet - 09/22/2003 updated by TerryHough
; (c) ses007, 2003
; From PB forum, topic
; http://purebasic.myforums.net/viewtopic.php?t=5590
#INTERNET_CONNECTION_MODEM = $1
#INTERNET_CONNECTION_LAN = $2
#INTERNET_CONNECTION_PROXY = $4
#INTERNET_CONNECTION_MODEM_BUSY = $8
#INTERNET_CONNECTION_OFFLINE = $20
#INTERNET_CONNECTION_CONFIGURED = $40
#INTERNET_RAS_INSTALLED = $10
Procedure.s InternetStatus()
Protected dwflags.b
Protected sFlags.s
Protected msg.s
If InternetGetConnectedState_(@dwflags, 0)
sFlags.s = RSet(Bin(dwflags),8,"0")
If Mid(sFlags,8,1) = "1" ; = #INTERNET_CONNECTION_MODEM
msg + "The Internet connection is made by a modem" + Chr(10)
EndIf
If Mid(sFlags,7,1) = "1" ; = #INTERNET_CONNECTION_LAN
msg + "The Internet connection is made via a network (LAN)"
EndIf
If Mid(sFlags,6,1) = "1" And Mid(sFlags,4,1) = "0" ; = #INTERNET_CONNECTION_PROXY
msg + " and using a Proxy server." + Chr(10)
Else
msg + "." + Chr(10)
EndIf
If Mid(sFlags,6,1) = "1" And Mid(sFlags,4,1) = "1" ; = #INTERNET_CONNECTION_OFFLINE
msg + "The Internet connection is currently offline. " + Chr(10)
EndIf
If Mid(sFlags,5,1) = "1" And Mid(sFlags,7,1) = "1" ; = #INTERNET_RAS_INSTALLED
msg + "A Remote Access Service (RAS) is installed." + Chr(10)
EndIf
If Mid(sFlags,5,1) = "1" And Mid(sFlags,6,1) = "0" ; = #INTERNET_CONNECTION_MODEM_BUSY
msg + "The modem is busy with another connection." + Chr(10)
EndIf
If Mid(sFlags,3,1) = "1" And Mid(sFlags,5,1) = "1" ; = #INTERNET_CONNECTION_CONFIGURED
msg + "An Internet connection is configured." + Chr(10)
EndIf
If Mid(sFlags,4,1) = "1" And Mid(sFlags,6,1) = "1" ; = #INTERNET_CONNECTION_OFFLINE
msg + "The Internet connection is currently offline. " + Chr(10)
EndIf
;msg + "dwFlags: " + sFlags + Chr(10) + Chr(10)
Else
msg = "Currently, there is no Internet connection." + Chr(10) + Chr(10)
EndIf
ProcedureReturn msg
EndProcedure
msg.s = InternetStatus()
Result.l = InternetAttemptConnect_(0)
If Result = #ERROR_SUCCESS
msg + "This system is currently connected or can connect to the Internet."
Else
msg + "This system cannot connect to the Internet."
errNumber.l = GetErrorNumber()
errDescription.s = GetErrorDescription()
msg + "Error Number: " + Str(errNumber) + Chr(10) + errDescription
EndIf
MessageRequester("Internet Connection", msg, #MB_ICONINFORMATION)
Code: Select all
If Mid(sFlags,7,1) = "1" ; = #INTERNET_CONNECTION_LAN
msg + "The Internet connection is made via a network (LAN)"
EndIf
Code: Select all
if CableModemInternalWebpageExists
Connection = CableModem
Endif