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. Checking Internet Connection

Checking Internet Connection

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
11 Posts 5 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.
  • T Offline
    T Offline
    T RATHA KRISHNAN
    wrote on last edited by
    #1

    Hi! I've to check whether my System is connected to the net. How to check the Internet connectivity with VC++? I'm using Windows XP.

    R P P 3 Replies Last reply
    0
    • T T RATHA KRISHNAN

      Hi! I've to check whether my System is connected to the net. How to check the Internet connectivity with VC++? I'm using Windows XP.

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #2

      See InternetGetConnectedState()[^]

      "Real men drive manual transmission" - Rajesh.

      T 1 Reply Last reply
      0
      • T T RATHA KRISHNAN

        Hi! I've to check whether my System is connected to the net. How to check the Internet connectivity with VC++? I'm using Windows XP.

        P Offline
        P Offline
        Pravin Patil Mumbai
        wrote on last edited by
        #3

        This http://visualcpp.net/index.php?qID=44[^] may help you. All the best.

        1 Reply Last reply
        0
        • R Rajesh R Subramanian

          See InternetGetConnectedState()[^]

          "Real men drive manual transmission" - Rajesh.

          T Offline
          T Offline
          T RATHA KRISHNAN
          wrote on last edited by
          #4

          Hi! Thanks for your reply. I used the following code and get these two errors:

          bool connectionStatus = InternetGetConnectedState(INTERNET_CONNECTION_OFFLINE,0);

          Errors: d:\downloadversion\downloadversion\Form1.h(31) : error C2065: 'INTERNET_CONNECTION_OFFLINE' : undeclared identifier d:\downloadversion\downloadversion\Form1.h(31) : error C3861: 'InternetGetConnectedState': identifier not found I'm using Windows Forms.

          R 1 Reply Last reply
          0
          • T T RATHA KRISHNAN

            Hi! Thanks for your reply. I used the following code and get these two errors:

            bool connectionStatus = InternetGetConnectedState(INTERNET_CONNECTION_OFFLINE,0);

            Errors: d:\downloadversion\downloadversion\Form1.h(31) : error C2065: 'INTERNET_CONNECTION_OFFLINE' : undeclared identifier d:\downloadversion\downloadversion\Form1.h(31) : error C3861: 'InternetGetConnectedState': identifier not found I'm using Windows Forms.

            R Offline
            R Offline
            Rajesh R Subramanian
            wrote on last edited by
            #5

            You'll need to include a header, and link to a library to use this function. Scroll down to the "Requirements" section of the MSDN link I provided you with.

            "Real men drive manual transmission" - Rajesh.

            T 1 Reply Last reply
            0
            • R Rajesh R Subramanian

              You'll need to include a header, and link to a library to use this function. Scroll down to the "Requirements" section of the MSDN link I provided you with.

              "Real men drive manual transmission" - Rajesh.

              T Offline
              T Offline
              T RATHA KRISHNAN
              wrote on last edited by
              #6

              Hi! It's told that minimum supported client and server as Windows 2000 Professional and Windows 2000 Server. Will it work with Windows XP? Do I have to download the following to my Solution path? Wininet.h Wininet.lib Wininet.dll

              R U 2 Replies Last reply
              0
              • T T RATHA KRISHNAN

                Hi! It's told that minimum supported client and server as Windows 2000 Professional and Windows 2000 Server. Will it work with Windows XP? Do I have to download the following to my Solution path? Wininet.h Wininet.lib Wininet.dll

                R Offline
                R Offline
                Rajesh R Subramanian
                wrote on last edited by
                #7

                T.RATHA KRISHNAN wrote:

                It's told that minimum supported client and server as Windows 2000 Professional and Windows 2000 Server. Will it work with Windows XP?

                Windows XP was released after Windows 2000. So, the API will work on XP.

                "Real men drive manual transmission" - Rajesh.

                1 Reply Last reply
                0
                • T T RATHA KRISHNAN

                  Hi! It's told that minimum supported client and server as Windows 2000 Professional and Windows 2000 Server. Will it work with Windows XP? Do I have to download the following to my Solution path? Wininet.h Wininet.lib Wininet.dll

                  U Offline
                  U Offline
                  User 3919723
                  wrote on last edited by
                  #8

                  try with

                  #include
                  #pragma comment(lib,"Wininet.lib")

                  T 1 Reply Last reply
                  0
                  • U User 3919723

                    try with

                    #include
                    #pragma comment(lib,"Wininet.lib")

                    T Offline
                    T Offline
                    T RATHA KRISHNAN
                    wrote on last edited by
                    #9

                    Member 3922639 wrote:

                    #include #pragma comment(lib,"Wininet.lib")

                    If I include the above code, I got 283 errors, all in the Wininet.h file(Syntax errors, missing type specifier errors and error C2378: 'HINTERNET' : redefinition; symbol cannot be overloaded with a typedef). Where shall I get the Wininet.h file? Do I have to Download and install Windows SDK to solve all these errors?

                    T 1 Reply Last reply
                    0
                    • T T RATHA KRISHNAN

                      Member 3922639 wrote:

                      #include #pragma comment(lib,"Wininet.lib")

                      If I include the above code, I got 283 errors, all in the Wininet.h file(Syntax errors, missing type specifier errors and error C2378: 'HINTERNET' : redefinition; symbol cannot be overloaded with a typedef). Where shall I get the Wininet.h file? Do I have to Download and install Windows SDK to solve all these errors?

                      T Offline
                      T Offline
                      T RATHA KRISHNAN
                      wrote on last edited by
                      #10

                      After I included "windows.h", all the errors vanished. Thanks alot.

                      1 Reply Last reply
                      0
                      • T T RATHA KRISHNAN

                        Hi! I've to check whether my System is connected to the net. How to check the Internet connectivity with VC++? I'm using Windows XP.

                        P Offline
                        P Offline
                        PJ Arends
                        wrote on last edited by
                        #11

                        http://www.codeproject.com/Tips/67577/Check-for-an-active-Internet-connection.aspx[^]


                        You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!

                        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