Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Internet connection

Internet connection

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    progman
    wrote on last edited by
    #1

    I want to verify internet connection from my application in VC++. (Is it or not ?) How ?

    N D B 3 Replies Last reply
    0
    • P progman

      I want to verify internet connection from my application in VC++. (Is it or not ?) How ?

      N Offline
      N Offline
      Nish Nishant
      wrote on last edited by
      #2

      progman wrote: I want to verify internet connection from my application in VC++. (Is it or not ?) Use a combination of InternetGetConnectedState and InternetCheckConnection Nish


      Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]

      1 Reply Last reply
      0
      • P progman

        I want to verify internet connection from my application in VC++. (Is it or not ?) How ?

        D Offline
        D Offline
        d_kilshtein
        wrote on last edited by
        #3

        Hi Progman! Try this small function: long MyView::IsConnected() { unsigned long ulConnectionFlags = 1; return InternetGetConnectedState(&ulConnectionFlags ,0); } To be sure you can add an attempt to open a site but I don’t think it is necessary. You must add the #include "WININET.H" line and WININET.lib to your project.

        1 Reply Last reply
        0
        • P progman

          I want to verify internet connection from my application in VC++. (Is it or not ?) How ?

          B Offline
          B Offline
          Big Art
          wrote on last edited by
          #4

          If using a modem use: RasEnumConnections(..) fn and check for to see if the number of connection is > 0. If checking to see if LAN is present then Ping a url. I avoid InternetGetConnectedState(..) because it is not dynamic. ie Pull the LAN connection out of the wall and your icon on you computer shows it is disconnected but the InternetGetConnectedState(..)fn won't track it! Art

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups