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. SetProxy function throwing exception

SetProxy function throwing exception

Scheduled Pinned Locked Moved C / C++ / MFC
sysadmin
5 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.
  • A Offline
    A Offline
    Ash_VCPP
    wrote on last edited by
    #1

    Hi all, i am using this smart pointer to send http request to server:- IServerXMLHTTPRequest2Ptr pIXMLHTTPRequest = NULL; Then through this I called the method setproxy where second parameter is having some ip address:- pIXMLHTTPRequest->setProxy(SXH_PROXY_SET_DIRECT,varProxyName,L""); but this is causing exception and getlasterror() is returning "3".Please rovide some suggestions.

    Thanks A Ton Ash_VCPP walking over water is just knowing where the stones are.....

    B 1 Reply Last reply
    0
    • A Ash_VCPP

      Hi all, i am using this smart pointer to send http request to server:- IServerXMLHTTPRequest2Ptr pIXMLHTTPRequest = NULL; Then through this I called the method setproxy where second parameter is having some ip address:- pIXMLHTTPRequest->setProxy(SXH_PROXY_SET_DIRECT,varProxyName,L""); but this is causing exception and getlasterror() is returning "3".Please rovide some suggestions.

      Thanks A Ton Ash_VCPP walking over water is just knowing where the stones are.....

      B Offline
      B Offline
      Bacon Ultimate Cheeseburger
      wrote on last edited by
      #2

      When you call setProxy() have you already acquired a pointer to an object implementing the IServerXMLHTTPRequest2 interface? Have you properly set up varProxyName?

      1300 calories of pure beef goodness can't be wrong!

      A 1 Reply Last reply
      0
      • B Bacon Ultimate Cheeseburger

        When you call setProxy() have you already acquired a pointer to an object implementing the IServerXMLHTTPRequest2 interface? Have you properly set up varProxyName?

        1300 calories of pure beef goodness can't be wrong!

        A Offline
        A Offline
        Ash_VCPP
        wrote on last edited by
        #3

        Hi Bacon, First of all thanks for the reply....i have posted it three times but i get first reply so thanks. i have used pointer of the interface like this: IServerXMLHTTPRequest2Ptr pIXMLHTTPRequest = NULL; and called the method setproxy on the same:- pIXMLHTTPRequest->setProxy(SXH_PROXY_SET_PROXY,varProxyName); where varProxyName = SysAllocString(L"114.127.246.36:8080"); when you sya...."have you already acquired a pointer to an object implementing the IServerXMLHTTPRequest2 interface" so can you explain it in detail.or if you can provide some example for set proxy then it would be really helpful, because i didnt get anything useful in google....

        Thanks A Ton Ash_VCPP walking over water is just knowing where the stones are.....

        B 1 Reply Last reply
        0
        • A Ash_VCPP

          Hi Bacon, First of all thanks for the reply....i have posted it three times but i get first reply so thanks. i have used pointer of the interface like this: IServerXMLHTTPRequest2Ptr pIXMLHTTPRequest = NULL; and called the method setproxy on the same:- pIXMLHTTPRequest->setProxy(SXH_PROXY_SET_PROXY,varProxyName); where varProxyName = SysAllocString(L"114.127.246.36:8080"); when you sya...."have you already acquired a pointer to an object implementing the IServerXMLHTTPRequest2 interface" so can you explain it in detail.or if you can provide some example for set proxy then it would be really helpful, because i didnt get anything useful in google....

          Thanks A Ton Ash_VCPP walking over water is just knowing where the stones are.....

          B Offline
          B Offline
          Bacon Ultimate Cheeseburger
          wrote on last edited by
          #4

          Ash_VCPP wrote:

          IServerXMLHTTPRequest2Ptr pIXMLHTTPRequest = NULL;

          When you assign NULL to pIXMLHTTPRequest this tells it to point to nothing. You have to get an object of type IServerXMLHTTPRequest2 and assign it to pIXMLHTTPRequest before you can use it.

          Ash_VCPP wrote:

          so can you explain it in detail.or if you can provide some example for set proxy then it would be really helpful, because i didnt get anything useful in google....

          I haven't used IServerXMLHTTPRequest but it's a COM based object so you'll need to call CoCreateInstance() at some point. If you're not familiar with COM I suggest reading one of the introductions here on CP.

          1300 calories of pure beef goodness can't be wrong!

          A 1 Reply Last reply
          0
          • B Bacon Ultimate Cheeseburger

            Ash_VCPP wrote:

            IServerXMLHTTPRequest2Ptr pIXMLHTTPRequest = NULL;

            When you assign NULL to pIXMLHTTPRequest this tells it to point to nothing. You have to get an object of type IServerXMLHTTPRequest2 and assign it to pIXMLHTTPRequest before you can use it.

            Ash_VCPP wrote:

            so can you explain it in detail.or if you can provide some example for set proxy then it would be really helpful, because i didnt get anything useful in google....

            I haven't used IServerXMLHTTPRequest but it's a COM based object so you'll need to call CoCreateInstance() at some point. If you're not familiar with COM I suggest reading one of the introductions here on CP.

            1300 calories of pure beef goodness can't be wrong!

            A Offline
            A Offline
            Ash_VCPP
            wrote on last edited by
            #5

            hi Bacon, Please see the code: HRESULT hresult = CoInitialize(NULL); IServerXMLHTTPRequest2Ptr pIXMLHTTPRequest = NULL; hr=pIXMLHTTPRequest.CreateInstance("Msxml2.ServerXMLHTTP.4.0"); that i have done.....please suggest if i am missing something.

            Thanks A Ton Ash_VCPP walking over water is just knowing where the stones are.....

            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