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. CInternetSession could not run in a message loop?

CInternetSession could not run in a message loop?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
12 Posts 2 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.
  • R Offline
    R Offline
    rushing
    wrote on last edited by
    #1

    I use a pointer of CInternetSession in a function. When I use the function by button, all things are ok. When I use it in a OnCommunication message function which recieves message from other device, there is a error 12006. The source code is like that: pIneternetSession->OpenURL(strUrl); I am sure the strUrl is right. Why?

    P 1 Reply Last reply
    0
    • R rushing

      I use a pointer of CInternetSession in a function. When I use the function by button, all things are ok. When I use it in a OnCommunication message function which recieves message from other device, there is a error 12006. The source code is like that: pIneternetSession->OpenURL(strUrl); I am sure the strUrl is right. Why?

      P Offline
      P Offline
      Prakash Nadar
      wrote on last edited by
      #2

      can you print out and check what exactly strUrl Contains, i did a google and got 12006 INTERNET_UNRECOGNIZED_SCHEME I am not sure though if its the rite error code meaning.


      -Prakash

      R 1 Reply Last reply
      0
      • P Prakash Nadar

        can you print out and check what exactly strUrl Contains, i did a google and got 12006 INTERNET_UNRECOGNIZED_SCHEME I am not sure though if its the rite error code meaning.


        -Prakash

        R Offline
        R Offline
        rushing
        wrote on last edited by
        #3

        strUrl is 'http://www.sina.com.cn/'

        P 1 Reply Last reply
        0
        • R rushing

          strUrl is 'http://www.sina.com.cn/'

          P Offline
          P Offline
          Prakash Nadar
          wrote on last edited by
          #4

          OpenURL throws a CInternetException exception, can you catch and figure out what exactly is the error.


          -Prakash

          R 1 Reply Last reply
          0
          • P Prakash Nadar

            OpenURL throws a CInternetException exception, can you catch and figure out what exactly is the error.


            -Prakash

            R Offline
            R Offline
            rushing
            wrote on last edited by
            #5

            I put a button on the dialog. After input the url into a textbox, push the button. Then the application will visit the web and download the webpage by OpenURL() function. Until now all things are good. Then I use a event to replace the button. The event will be call by a RS232 input message. I use the same function to visit the web. Now there is a error CInternetException 12006. I see the error code from dgbView and the debug version.

            P 1 Reply Last reply
            0
            • R rushing

              I put a button on the dialog. After input the url into a textbox, push the button. Then the application will visit the web and download the webpage by OpenURL() function. Until now all things are good. Then I use a event to replace the button. The event will be call by a RS232 input message. I use the same function to visit the web. Now there is a error CInternetException 12006. I see the error code from dgbView and the debug version.

              P Offline
              P Offline
              Prakash Nadar
              wrote on last edited by
              #6

              sorry it is difficult to diagonose the problem without understanding what those error code is. if you have not solved the problem yet, i would suggest you to post a event (a user defined probably or WM_COMMAND that you were using before) and then call that api. I am not sure, but may be it is conflicting with the data processing event call. btw, are you calling the OpenURL from the same window that you were doing before?


              -Prakash

              R 3 Replies Last reply
              0
              • P Prakash Nadar

                sorry it is difficult to diagonose the problem without understanding what those error code is. if you have not solved the problem yet, i would suggest you to post a event (a user defined probably or WM_COMMAND that you were using before) and then call that api. I am not sure, but may be it is conflicting with the data processing event call. btw, are you calling the OpenURL from the same window that you were doing before?


                -Prakash

                R Offline
                R Offline
                rushing
                wrote on last edited by
                #7

                I put the function into a new event (WM_USER+1). Other fuction use it by PostMessage. Now the error is CInternetSession 78.

                1 Reply Last reply
                0
                • P Prakash Nadar

                  sorry it is difficult to diagonose the problem without understanding what those error code is. if you have not solved the problem yet, i would suggest you to post a event (a user defined probably or WM_COMMAND that you were using before) and then call that api. I am not sure, but may be it is conflicting with the data processing event call. btw, are you calling the OpenURL from the same window that you were doing before?


                  -Prakash

                  R Offline
                  R Offline
                  rushing
                  wrote on last edited by
                  #8

                  The new error is : Warnging:throwing CInternetException for error 87 OpenURL is not in the same window with the event, it is in a class which has a instance in the dialog.

                  1 Reply Last reply
                  0
                  • P Prakash Nadar

                    sorry it is difficult to diagonose the problem without understanding what those error code is. if you have not solved the problem yet, i would suggest you to post a event (a user defined probably or WM_COMMAND that you were using before) and then call that api. I am not sure, but may be it is conflicting with the data processing event call. btw, are you calling the OpenURL from the same window that you were doing before?


                    -Prakash

                    R Offline
                    R Offline
                    rushing
                    wrote on last edited by
                    #9

                    I found the reason is that there is a space ' ' before the URL.

                    P 1 Reply Last reply
                    0
                    • R rushing

                      I found the reason is that there is a space ' ' before the URL.

                      P Offline
                      P Offline
                      Prakash Nadar
                      wrote on last edited by
                      #10

                      rushing wrote:

                      I found the reason is that there is a space ' ' before the URL.

                      didnt I tell u that there could be some problem with the url ;), good that you identified. I had a similar problem long back where a space in the parameter was causing a problem and it was resolved only after weeks of debuging.:omg:


                      -Prakash

                      R 1 Reply Last reply
                      0
                      • P Prakash Nadar

                        rushing wrote:

                        I found the reason is that there is a space ' ' before the URL.

                        didnt I tell u that there could be some problem with the url ;), good that you identified. I had a similar problem long back where a space in the parameter was causing a problem and it was resolved only after weeks of debuging.:omg:


                        -Prakash

                        R Offline
                        R Offline
                        rushing
                        wrote on last edited by
                        #11

                        I am lucky to meet you. Happy Spring Festival!

                        P 1 Reply Last reply
                        0
                        • R rushing

                          I am lucky to meet you. Happy Spring Festival!

                          P Offline
                          P Offline
                          Prakash Nadar
                          wrote on last edited by
                          #12

                          rushing wrote:

                          I am lucky to meet you.

                          :->, there are many more smarter ppl than me here in code-project, you would be even more luckier if you meet them too ;)


                          -Prakash

                          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