Restored from previous forum. Originally posted by MrVainSCL.
Here is a small codesnip to check if you are connected to a network 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 - CheckNetworkConnection - Example v1.0
;
; by MrVainSCL! aka Thorsten 19/Jan/2003 PB v3.51+
;
; ------------------------------------------------------------
;
If GetSystemMetrics_(#SM_NETWORK) And $01 = 1
state$ = "Connected"
Else
state$ = "Disconnected"
EndIf
;
MessageRequester("Are we connected to a Network?","We are "+state$,0)
End
;
; ------------------------------------------------------------
Code: Select all
; ------------------------------------------------------------
;
; PureBasic Win32 API - CheckNetworkConnection - Example v1.0
;
; by MrVainSCL! aka Thorsten 19/Jan/2003 PB v3.51+
;
; ------------------------------------------------------------
;
Procedure MyCheckNetworkConnection()
If GetSystemMetrics_(#SM_NETWORK) And $01 = 1
result = 1
Else
result = 0
EndIf
;
ProcedureReturn result
EndProcedure;
;
; -------- Check if user is connected to a network --------
;
If MyCheckNetworkConnection() = 1
state$ = "Connected"
Else
state$ = "Disconnected"
EndIf
;
MessageRequester("Are we connected to a Network?","We are "+state$,0)
End
;
; ------------------------------------------------------------
PIII450, 256MB Ram, 80GB HD + 6,4 GB, RivaTNT, DirectX9.0, SB AWE64, Win2000 + all Updates...
greetz
MrVainSCL! aka Thorsten