Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compile Exe
#Dim All
%Unicode = 1
#Include "cwindow.inc"
#Include "wininet.inc"
Global hDlg As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "Test Code",300,300,200,200, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, 100,"Push", 50,10,100,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local iResult,dwFlag As Long, URL$
If Cb.Msg = %WM_Command And Cb.Ctl = 100 And Cb.CtlMsg = %BN_Clicked Then
'approach #1
URL$ = "http://www.google.com
iResult = InternetCheckConnection((URL$), %FLAG_ICC_FORCE_CONNECTION, ByVal 0) '%True if connected, %False if not
If iResult Then ? "Connected" Else ? "Not Connected"
'approach #2
iResult = InternetGetConnectedState(dwFlag, ByVal 0) '%True if connected, %False if not
If iResult Then ? "Connected" Else ? "Not Connected"
'approach #3
iResult = InternetGetConnectedStateEx(dwFlag, "", 255, ByVal 0)
If iResult Then ? "Connected" Else ? "Not Connected"
End If
End Function
'gbs_01301
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm