Sign in to follow this  
Followers 0
rajeshontheweb

DllCall - InternetCheckConnection (InternetGetConnectedState works)

4 posts in this topic

#1 ·  Posted (edited)

BOOL InternetCheckConnection(
  LPCTSTR lpszUrl,
  DWORD dwFlags,
  DWORD dwReserved
);

is represented as

$ret = DllCall("WinInet.dll","int","InternetGetConnectedState","int_ptr",0,"int",0)

$ret[0] = 1 if connected 

$ret[1] possibly one of these or blank 

$INTERNET_CONNECTION_MODEM          = 0x1
$INTERNET_CONNECTION_LAN            = 0x2
$INTERNET_CONNECTION_PROXY          = 0x4
$INTERNET_CONNECTION_MODEM_BUSY     = 0x8
$INTERNET_RAS_INSTALLED             = 0x10
$INTERNET_CONNECTION_OFFLINE        = 0x20
$INTERNET_CONNECTION_CONFIGURED     = 0x40
Edited by rajeshontheweb

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

i know i am wrong somewhere i donno where

i need to first check connection state and then will check google.com

much like ping but i want to compare ping vs internetcheckconnection time taken...

Allows an application to check if a connection to the Internet can be established.

Parameter Information

Declare Function InternetCheckConnection Lib "wininet.dll" Alias "InternetCheckConnectionA" (ByVal lpszUrl As _

String, ByVal dwFlags As Long, ByVal dwReserved As Long) As Long

· lpszUrl

[in">

Pointer to a string containing the URL to use to check the connection. This value can be set to NULL.

· dwFlags

[in] Unsigned long integer value containing the flag values. FLAG_ICC_FORCE_CONNECTION is the only flag that is currently available. If this flag is set, it forces a connection. A sockets connection is attempted in the following order.

If lpszUrl is non-NULL, the host value is extracted from it and used to ping that specific host.

If lpszUrl is NULL and there is an entry in WinInet's internal server database for the nearest server, the host value is extracted from the entry and used to ping that server

· dwReserved

[in] Reserved. Must be set to zero.

Returns TRUE if a connection is made successfully, or FALSE otherwise. Use GetLastError to retrieve the error code. ERROR_NOT_CONNECTED is returned by GetLastError if a connection cannot be made or if the sockets database is unconditionally offline.

Edited by rajeshontheweb

Share this post


Link to post
Share on other sites

i know i am wrong somewhere i donno where

i need to first check connection state and then will check google.com

much like ping but i want to compare ping vs internetcheckconnection time taken...

rejeshontheweb - Try the _LocalSystem_IsInet_Connected function within _ConnectSq.au3 - look below in the signature of this post.

After some research, I decided that the WinInet function it calls is the most reliable way to check for a connection brcause some workstations don't allow an out-going Ping. :pinch:


Das Häschen benutzt Radar

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

sorry for the rather delayed reply, but i was lost in another project i had taken, i am gonna use InterGetconnectedStateEx and then InternetCheckConnection, as u mentioned, i would not rather try ping coz smtp.google.com for example, doesnt always work well while pinged. so i need to get the internetcheckconnection only, probably.

sorry there's been a double post, i did think it was sorted i have the code in my repository. pls get the update here. http://www.autoitscript.com/forum/index.ph...CheckConnection thanks.

Edited by rajeshontheweb

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0