InternetCheckConnection

This is a discussion on InternetCheckConnection within the Networking/Device Communication forums, part of the General Programming Boards category; This is the code I'm using for checking my internet connection: Code: if (!InternetCheckConnection( "http://www.google.com" , FLAG_ICC_FORCE_CONNECTION , NULL ) ...

  1. #1
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401

    InternetCheckConnection

    This is the code I'm using for checking my internet connection:
    Code:
    if (!InternetCheckConnection( "http://www.google.com" , FLAG_ICC_FORCE_CONNECTION , NULL ) )
    It is the only combination of parameters that works, ie, I have to give a valid URL, and I have to use the flag. Is it supposed to be like that? For compatibility, I wouldn't want to have to assume that I was specifying a valid URL. I know it's pedantic, but is there any way to avoid specifying a URL?
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  2. #2
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    sure!

    you can read a little about the function and see that if a url is non-null, the function pings the given url!

    but you can set the url to NULL, and allow it to find it's own valid url to ping to.

    If lpszUrl is NULL and there is an entry in WinInet's internal server database for the nearest sever, the host value is extracted from the entry and used to ping that server
    but tell me, when was the last time google had been unavailable?
    Last edited by Devil Panther; 11-12-2003 at 11:52 PM.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  3. #3
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    The function was never successful if I didn't specify a URL to use.

    I know google will be around for a long time, but still, just in case...
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21