On Tue, Jun 30, 2009 at 3:15 AM, Dennis Birch<dennisbirch@gmail.com> wrote:
> On Mon, Jun 29, 2009 at 1:40 AM, Carlos M<rblists@rbtips.com> wrote:
>
>> For Windows check the WFS InternetConnection module:
>> http://aaronballman.com/programming/REALbasic/Win32FunctionalitySuite.php
>
> Thanks for the tip, Carlos. I put together a test project and ran it
> in Windows 7 beta which is installed in VirtualBox on my iMac.
>
> I get the exact same values for each of the following module tests
> with the DSL modem plugged into the switch and removed from the
> switch:
>
> dim offline As Boolean = InternetConnection.Offline
> dim configured As Boolean = InternetConnection.Configured
> dim lan As Boolean = InternetConnection.LAN
> dim noconnection As Boolean = InternetConnection.NoConnection
> dim modem As Boolean = InternetConnection.Modem
> dim busy As Boolean = InternetConnection.ModemBusy
> dim proxy As Boolean = InternetConnection.Proxy
>
> Have I overlooked something, does it not work the same in a virtual
> machine as in a real PC, is it Windows 7, or what?
I'm using only Windows, so I can't help you with this. On Windows XP
it works fine.
Anyway, here's a function that I added to that module that might help
you. It allows to check if a connection to internet can be made by
using a url.
InternetCheckConnection Function
http://msdn.microsoft.com/en-us/library/aa384346(VS.85).aspx
Function HostReacheable(url As String, forceConnection As Boolean =
False) As Boolean
// Returns if a connection to a host (using an URL) can be established
// Note: If forceConnection is True it will try to force a connection and if
// there's a firewall an alert might be displayed
#if TargetWin32
// FLAG_ICC_FORCE_CONNECTION = &H1
Soft Declare Function InternetCheckConnectionA Lib "Wininet" _
( lpszUrl As CString, dwFlags As Integer, dwReserved As Integer ) As Boolean
// On 2005r4 and Windows XP the Unicode version DOES NOT WORK
// Didn't try to figure why... so I'm using the ANSI version
'Soft Declare Function InternetCheckConnectionW Lib "Wininet" _
'( lpszUrl As CString, dwFlags As Integer, dwReserved As Integer )
As Boolean
Dim b As Boolean
If System.IsFunctionAvailable( "InternetCheckConnectionA", "Wininet" ) Then
If forceConnection Then
b = InternetCheckConnectionA( url, &h1, 0 )
Else
b = InternetCheckConnectionA( url, 0, 0 )
End if
End If
Return b
#endif
End Function
Carlos
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|