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. what is equivelent of Inet1.OpenURL in visual c++ 6

what is equivelent of Inet1.OpenURL in visual c++ 6

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
13 Posts 3 Posters 1 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.
  • M Offline
    M Offline
    method007
    wrote on last edited by
    #1

    Hi all could any one tell me what is the the equivelent the following visual basic 6 code. txtURl holds a url of a perticuler website.Thanks RichTextBox1.Text = Inet1.OpenURL(txtURL.Text, icString)

    D 1 Reply Last reply
    0
    • M method007

      Hi all could any one tell me what is the the equivelent the following visual basic 6 code. txtURl holds a url of a perticuler website.Thanks RichTextBox1.Text = Inet1.OpenURL(txtURL.Text, icString)

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      There is no direct equivalent. Try calling InternetOpenUrl() followed by InternetReadFile().


      "The largest fire starts but with the smallest spark." - David Crow

      "Judge not by the eye but by the heart." - Native American Proverb

      M 1 Reply Last reply
      0
      • D David Crow

        There is no direct equivalent. Try calling InternetOpenUrl() followed by InternetReadFile().


        "The largest fire starts but with the smallest spark." - David Crow

        "Judge not by the eye but by the heart." - Native American Proverb

        M Offline
        M Offline
        method007
        wrote on last edited by
        #3

        thank u for u reply. could u tell me how to sue these 2 . where to specify the url ? i want the html to be placed inside editbox. could u just show me how.Thanks

        L 1 Reply Last reply
        0
        • M method007

          thank u for u reply. could u tell me how to sue these 2 . where to specify the url ? i want the html to be placed inside editbox. could u just show me how.Thanks

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          method007 wrote:

          could u just show me how

          Googling: MSDN InternetReadFile produced hits where the second one listed is titled "Building an Internet Browser Using the Win32 Internet Functions". The following sample code is contained in that article which you could have easily found for yourself.

          HINTERNET hNet = ::InternetOpen("MSDN SurfBear",
          PRE_CONFIG_INTERNET_ACCESS,
          NULL,
          INTERNET_INVALID_PORT_NUMBER,
          0) ;

          HINTERNET hUrlFile = ::InternetOpenUrl(hNet,
          "http://www.microsoft.com",
          NULL,
          0,
          INTERNET_FLAG_RELOAD,
          0) ;

          char buffer[10*1024] ;
          DWORD dwBytesRead = 0;
          BOOL bRead = ::InternetReadFile(hUrlFile,
          buffer,
          sizeof(buffer),
          &dwBytesRead);

          ::InternetCloseHandle(hUrlFile) ;

          ::InternetCloseHandle(hNet) ;

          "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
          Colin Angus Mackay in the C# forum

          led mike

          M 1 Reply Last reply
          0
          • L led mike

            method007 wrote:

            could u just show me how

            Googling: MSDN InternetReadFile produced hits where the second one listed is titled "Building an Internet Browser Using the Win32 Internet Functions". The following sample code is contained in that article which you could have easily found for yourself.

            HINTERNET hNet = ::InternetOpen("MSDN SurfBear",
            PRE_CONFIG_INTERNET_ACCESS,
            NULL,
            INTERNET_INVALID_PORT_NUMBER,
            0) ;

            HINTERNET hUrlFile = ::InternetOpenUrl(hNet,
            "http://www.microsoft.com",
            NULL,
            0,
            INTERNET_FLAG_RELOAD,
            0) ;

            char buffer[10*1024] ;
            DWORD dwBytesRead = 0;
            BOOL bRead = ::InternetReadFile(hUrlFile,
            buffer,
            sizeof(buffer),
            &dwBytesRead);

            ::InternetCloseHandle(hUrlFile) ;

            ::InternetCloseHandle(hNet) ;

            "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
            Colin Angus Mackay in the C# forum

            led mike

            M Offline
            M Offline
            method007
            wrote on last edited by
            #5

            Thank u for u reply. so how to use the html code and display it in a textbox ? I tried this to place the html in textbox and gives me 17 errors!! void CFindUserDlg::OnButton4() { // TODO: Add your control notification handler code here HINTERNET hNet = ::InternetOpen("MSDN SurfBear",PRE_CONFIG_INTERNET_ACCESS,NULL,INTERNET_INVALID_PORT_NUMBER,0) ; HINTERNET hUrlFile = ::InternetOpenUrl(hNet,"http://www.cnn.com",NULL,0,INTERNET_FLAG_RELOAD,0) ; char buffer[10*1024] ; DWORD dwBytesRead = 0; BOOL bRead = ::InternetReadFile(hUrlFile,buffer,sizeof(buffer),&dwBytesRead); **SetDlgItemText(IDC_EDIT2,buffer);** ::InternetCloseHandle(hUrlFile) ; ::InternetCloseHandle(hNet) ; } -- modified at 13:00 Wednesday 12th July, 2006

            L 1 Reply Last reply
            0
            • M method007

              Thank u for u reply. so how to use the html code and display it in a textbox ? I tried this to place the html in textbox and gives me 17 errors!! void CFindUserDlg::OnButton4() { // TODO: Add your control notification handler code here HINTERNET hNet = ::InternetOpen("MSDN SurfBear",PRE_CONFIG_INTERNET_ACCESS,NULL,INTERNET_INVALID_PORT_NUMBER,0) ; HINTERNET hUrlFile = ::InternetOpenUrl(hNet,"http://www.cnn.com",NULL,0,INTERNET_FLAG_RELOAD,0) ; char buffer[10*1024] ; DWORD dwBytesRead = 0; BOOL bRead = ::InternetReadFile(hUrlFile,buffer,sizeof(buffer),&dwBytesRead); **SetDlgItemText(IDC_EDIT2,buffer);** ::InternetCloseHandle(hUrlFile) ; ::InternetCloseHandle(hNet) ; } -- modified at 13:00 Wednesday 12th July, 2006

              L Offline
              L Offline
              led mike
              wrote on last edited by
              #6

              from the sample the "char" array named "buffer" would contain the HTML. In C/C++ char arrays are "strings" so basicaly you can copy that buffer into the edit control. I don't know why you are doing this in C++ from a VB background but things are very different in C/C++ from VB. There are so many different ways to get a char array into a windows edit control depending on "how" you are developing your solution. If using MFC you have classes that you are using that simplify these operations. If not you must send messages to windows controls to interact with them. This is a small part of the fundamental knowledge needed for windows development in C/C++. Asking questions in a forum about using API's when you don't have basic C/C++ experience will be a very slow and tiresome process.

              "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
              Colin Angus Mackay in the C# forum

              led mike

              M 1 Reply Last reply
              0
              • L led mike

                from the sample the "char" array named "buffer" would contain the HTML. In C/C++ char arrays are "strings" so basicaly you can copy that buffer into the edit control. I don't know why you are doing this in C++ from a VB background but things are very different in C/C++ from VB. There are so many different ways to get a char array into a windows edit control depending on "how" you are developing your solution. If using MFC you have classes that you are using that simplify these operations. If not you must send messages to windows controls to interact with them. This is a small part of the fundamental knowledge needed for windows development in C/C++. Asking questions in a forum about using API's when you don't have basic C/C++ experience will be a very slow and tiresome process.

                "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
                Colin Angus Mackay in the C# forum

                led mike

                M Offline
                M Offline
                method007
                wrote on last edited by
                #7

                well i have done this in visual basic 6 but i am working in a project that is only possible in visual c++ and this has to be done in visual C++ as well Any ways still i did not get my asnwer.!! i want to place the html code of the url inside a variable and editbox but adding SetDlgItemText(IDC_EDIT2,buffer); to your code did not compile and gave me 16 erros!! could u just help me fix that problem errors: --------------------Configuration: FindUser - Win32 Debug-------------------- Compiling... FindUserDlg.cpp C:\visualC\FindUser\FindUserDlg.cpp(330) : error C2065: 'HINTERNET' : undeclared identifier C:\visualC\FindUser\FindUserDlg.cpp(330) : error C2146: syntax error : missing ';' before identifier 'hNet' C:\visualC\FindUser\FindUserDlg.cpp(330) : error C2065: 'hNet' : undeclared identifier C:\visualC\FindUser\FindUserDlg.cpp(330) : error C2039: 'InternetOpen' : is not a member of '`global namespace'' C:\visualC\FindUser\FindUserDlg.cpp(330) : error C2065: 'InternetOpen' : undeclared identifier C:\visualC\FindUser\FindUserDlg.cpp(330) : error C2065: 'PRE_CONFIG_INTERNET_ACCESS' : undeclared identifier C:\visualC\FindUser\FindUserDlg.cpp(330) : error C2065: 'INTERNET_INVALID_PORT_NUMBER' : undeclared identifier C:\visualC\FindUser\FindUserDlg.cpp(331) : error C2146: syntax error : missing ';' before identifier 'hUrlFile' C:\visualC\FindUser\FindUserDlg.cpp(331) : error C2065: 'hUrlFile' : undeclared identifier C:\visualC\FindUser\FindUserDlg.cpp(331) : error C2039: 'InternetOpenUrl' : is not a member of '`global namespace'' C:\visualC\FindUser\FindUserDlg.cpp(331) : error C2065: 'InternetOpenUrl' : undeclared identifier C:\visualC\FindUser\FindUserDlg.cpp(331) : error C2065: 'INTERNET_FLAG_RELOAD' : undeclared identifier C:\visualC\FindUser\FindUserDlg.cpp(335) : error C2039: 'InternetReadFile' : is not a member of '`global namespace'' C:\visualC\FindUser\FindUserDlg.cpp(335) : error C2065: 'InternetReadFile' : undeclared identifier C:\visualC\FindUser\FindUserDlg.cpp(339) : error C2039: 'InternetCloseHandle' : is not a member of '`global namespace'' C:\visualC\FindUser\FindUserDlg.cpp(339) : error C2065: 'InternetCloseHandle' : undeclared identifier Error executing cl.exe. FindUser.exe - 16 error(s), 0 warning(s) code that give me 16 errors: void CFindUserDlg::OnButton4() { // TODO: Add your control notification handler code here HINTERNET hNet = ::InternetOpen("MSDN SurfBear",PRE_CONFIG_INTERNET_ACCESS,NULL,INTERNET_INVALID_PORT_NUMBER,0)

                L 1 Reply Last reply
                0
                • M method007

                  well i have done this in visual basic 6 but i am working in a project that is only possible in visual c++ and this has to be done in visual C++ as well Any ways still i did not get my asnwer.!! i want to place the html code of the url inside a variable and editbox but adding SetDlgItemText(IDC_EDIT2,buffer); to your code did not compile and gave me 16 erros!! could u just help me fix that problem errors: --------------------Configuration: FindUser - Win32 Debug-------------------- Compiling... FindUserDlg.cpp C:\visualC\FindUser\FindUserDlg.cpp(330) : error C2065: 'HINTERNET' : undeclared identifier C:\visualC\FindUser\FindUserDlg.cpp(330) : error C2146: syntax error : missing ';' before identifier 'hNet' C:\visualC\FindUser\FindUserDlg.cpp(330) : error C2065: 'hNet' : undeclared identifier C:\visualC\FindUser\FindUserDlg.cpp(330) : error C2039: 'InternetOpen' : is not a member of '`global namespace'' C:\visualC\FindUser\FindUserDlg.cpp(330) : error C2065: 'InternetOpen' : undeclared identifier C:\visualC\FindUser\FindUserDlg.cpp(330) : error C2065: 'PRE_CONFIG_INTERNET_ACCESS' : undeclared identifier C:\visualC\FindUser\FindUserDlg.cpp(330) : error C2065: 'INTERNET_INVALID_PORT_NUMBER' : undeclared identifier C:\visualC\FindUser\FindUserDlg.cpp(331) : error C2146: syntax error : missing ';' before identifier 'hUrlFile' C:\visualC\FindUser\FindUserDlg.cpp(331) : error C2065: 'hUrlFile' : undeclared identifier C:\visualC\FindUser\FindUserDlg.cpp(331) : error C2039: 'InternetOpenUrl' : is not a member of '`global namespace'' C:\visualC\FindUser\FindUserDlg.cpp(331) : error C2065: 'InternetOpenUrl' : undeclared identifier C:\visualC\FindUser\FindUserDlg.cpp(331) : error C2065: 'INTERNET_FLAG_RELOAD' : undeclared identifier C:\visualC\FindUser\FindUserDlg.cpp(335) : error C2039: 'InternetReadFile' : is not a member of '`global namespace'' C:\visualC\FindUser\FindUserDlg.cpp(335) : error C2065: 'InternetReadFile' : undeclared identifier C:\visualC\FindUser\FindUserDlg.cpp(339) : error C2039: 'InternetCloseHandle' : is not a member of '`global namespace'' C:\visualC\FindUser\FindUserDlg.cpp(339) : error C2065: 'InternetCloseHandle' : undeclared identifier Error executing cl.exe. FindUser.exe - 16 error(s), 0 warning(s) code that give me 16 errors: void CFindUserDlg::OnButton4() { // TODO: Add your control notification handler code here HINTERNET hNet = ::InternetOpen("MSDN SurfBear",PRE_CONFIG_INTERNET_ACCESS,NULL,INTERNET_INVALID_PORT_NUMBER,0)

                  L Offline
                  L Offline
                  led mike
                  wrote on last edited by
                  #8

                  method007 wrote:

                  is only possible in visual c++

                  Why? A .NET application would seem to be a much better choice.

                  method007 wrote:

                  code did not compile and gave me 16 erros!!

                  this is exactly what I meant about not having C/C++ basic experience. It could take you months and hundreds of posts to finsish your job using a forum.

                  method007 wrote:

                  error C2065: 'HINTERNET' : undeclared identifier

                  That means you have not included a required header file. That is basic C/C++ knowledge. A perfect example of what I am telling you. If you are going to develop using VC++ you better go back to the start and learn some basics, jumping into an actual project when you don't even know about including header files is completely insane.

                  "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
                  Colin Angus Mackay in the C# forum

                  led mike

                  M 1 Reply Last reply
                  0
                  • L led mike

                    method007 wrote:

                    is only possible in visual c++

                    Why? A .NET application would seem to be a much better choice.

                    method007 wrote:

                    code did not compile and gave me 16 erros!!

                    this is exactly what I meant about not having C/C++ basic experience. It could take you months and hundreds of posts to finsish your job using a forum.

                    method007 wrote:

                    error C2065: 'HINTERNET' : undeclared identifier

                    That means you have not included a required header file. That is basic C/C++ knowledge. A perfect example of what I am telling you. If you are going to develop using VC++ you better go back to the start and learn some basics, jumping into an actual project when you don't even know about including header files is completely insane.

                    "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
                    Colin Angus Mackay in the C# forum

                    led mike

                    M Offline
                    M Offline
                    method007
                    wrote on last edited by
                    #9

                    i know man i need to learn the basic and i do not know how to defind a header for it !! :-((

                    L 1 Reply Last reply
                    0
                    • M method007

                      i know man i need to learn the basic and i do not know how to defind a header for it !! :-((

                      L Offline
                      L Offline
                      led mike
                      wrote on last edited by
                      #10

                      Buy a book for beginner C++ . Don't do a project until you actually understand everything in the book. Once you understand everything in the beginner C++ book you will have scratched the surface. :) Then repeat for Windows Development. Then repeat for HTTP and HTML ( of course this book may not exist ). :-D Of course there is the famous book "Learn Visual C++ in 21 days". You could try that one... and if in 21 days you have actually learned Visual C++ "completely" you should donate half your salary for the next 5 years to the author. :-D

                      "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
                      Colin Angus Mackay in the C# forum

                      led mike

                      M 1 Reply Last reply
                      0
                      • L led mike

                        Buy a book for beginner C++ . Don't do a project until you actually understand everything in the book. Once you understand everything in the beginner C++ book you will have scratched the surface. :) Then repeat for Windows Development. Then repeat for HTTP and HTML ( of course this book may not exist ). :-D Of course there is the famous book "Learn Visual C++ in 21 days". You could try that one... and if in 21 days you have actually learned Visual C++ "completely" you should donate half your salary for the next 5 years to the author. :-D

                        "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
                        Colin Angus Mackay in the C# forum

                        led mike

                        M Offline
                        M Offline
                        method007
                        wrote on last edited by
                        #11

                        man i have the book Learn Visual C++ in 21 days and i read first few chapters. so u think your solution will allow me get the dynamic html that i need for further process corectly? The reason i want to make sure is that the html that i am after is dynamic and i need to retrive it every one min so i do not want to get the old html for each request. Furthermor, could u tell me what chapter of that books talkes about retriving html ?

                        L 1 Reply Last reply
                        0
                        • M method007

                          man i have the book Learn Visual C++ in 21 days and i read first few chapters. so u think your solution will allow me get the dynamic html that i need for further process corectly? The reason i want to make sure is that the html that i am after is dynamic and i need to retrive it every one min so i do not want to get the old html for each request. Furthermor, could u tell me what chapter of that books talkes about retriving html ?

                          L Offline
                          L Offline
                          led mike
                          wrote on last edited by
                          #12

                          I must apologize. :-O My comments about that book are pure sarcasm. No one can learn Visual C++ in 21 days. I have no idea what is in the book because the title is so stupid I would never read it or recommend it.

                          "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
                          Colin Angus Mackay in the C# forum

                          led mike

                          M 1 Reply Last reply
                          0
                          • L led mike

                            I must apologize. :-O My comments about that book are pure sarcasm. No one can learn Visual C++ in 21 days. I have no idea what is in the book because the title is so stupid I would never read it or recommend it.

                            "Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
                            Colin Angus Mackay in the C# forum

                            led mike

                            M Offline
                            M Offline
                            method007
                            wrote on last edited by
                            #13

                            led i want to thank u i fixed that code it works good! :-))

                            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