Restored from previous forum. Originally posted by MrVainSCL.
Here is a small codesnip to check if you are connected to the internet or not... Maybe usefull for some people trying to write any network based appz.
Here is a normal version:
Code: Select all
; ------------------------------------------------------------
;
; PureBasic Win32 API - CheckInternetConnection - Example v1.0
;
; by MrVainSCL! aka Thorsten 19/Jan/2003 PB v3.51+
;
; ------------------------------------------------------------
;
If InternetGetConnectedState_(0, 0)
result$ = "Online"
Else
result$ = "Offline"
EndIf
;
MessageRequester("Are we connected to the Internet?","We are "+result$,0)
End
;
; ------------------------------------------------------------
Code: Select all
; ------------------------------------------------------------
;
; PureBasic Win32 API - CheckInternetConnection - Example v1.0
;
; by MrVainSCL! aka Thorsten 19/Jan/2003 PB v3.51+
;
; ------------------------------------------------------------
;
Procedure MyCheckInternetConnection()
If InternetGetConnectedState_(0, 0)
result = 1
Else
result = 0
EndIf
;
ProcedureReturn result
EndProcedure
;
; -------- Check if user is connected to internet --------
;
If MyCheckInternetConnection() = 1
state$ = "Online"
Else
state$ = "Offline"
EndIf
;
MessageRequester("Are we connected to the Internet?","We are "+state$,0)
End
;
; ------------------------------------------------------------
Added 00:29 am - Requirements
Windows NT/2000/XP: Included in Windows NT 4.0 or later.
Windows 95/98/Me: Included in Windows 95 or later.
Version: Requires Internet Explorer 4.0 or later.
PIII450, 256MB Ram, 80GB HD + 6,4 GB, RivaTNT, DirectX9.0, SB AWE64, Win2000 + all Updates...
greetz
MrVainSCL! aka Thorsten