locked
Where is CXMLHttpRequest2Callback Declared?

    Question

  • I'm trying to apply the IXHR2 quickstart example in a basic experiment that creates a C++ class that will perform an HTTP GET. I'm running into errors about "undeclared identifiers" right off the bat.

    Here is the Quickstart example I'm using...

    http://msdn.microsoft.com/en-US/library/windows/apps/xaml/hh770550

    Here is my simple C++ class. I added it to a project I created using the Blank App C++ metro app template.

    // try_http.cpp

    #include "pch.h"
    #include "try_http.h"

    #include <wrl.h>
    #include <wrl/client.h>
    #include <wrl/implements.h>
    #include <MsXml6.h>
    #include <Windows.h>

    using namespace Microsoft::WRL;
    using namespace Microsoft::WRL::Details;


    try_http::try_http(void)
    {
    }


    try_http::~try_http(void)
    {
    }

    void try_http::try_get ()
    {

     //http://msdn.microsoft.com/en-US/library/windows/apps/xaml/hh770550
     DWORD dwStatus = 0;
     ComPtr<IXMLHTTPRequest2> spXHR;
     ComPtr<CXMLHttpRequest2Callback> spMyXhrCallback;
     ComPtr<IXMLHTTPRequest2Callback> spXhrCallback;

    }

    I get 4 erros compiling all reported for this line:

    ComPtr<CXMLHttpRequest2Callback> spMyXhrCallback;

    Error 1 error C2065: 'CXMLHttpRequest2Callback' : undeclared identifier c:\users\dfran_000\documents\visual studio 2012\projects\httpexperiment\httpexperiment\try_http.cpp 30 1 HTTPExperiment
    Error 2 error C2923: 'Microsoft::WRL::ComPtr' : 'CXMLHttpRequest2Callback' is not a valid template type argument for parameter 'T' c:\users\dfran_000\documents\visual studio 2012\projects\httpexperiment\httpexperiment\try_http.cpp 30 1 HTTPExperiment
    Error 3 error C2133: 'spMyXhrCallback' : unknown size c:\users\dfran_000\documents\visual studio 2012\projects\httpexperiment\httpexperiment\try_http.cpp 30 1 HTTPExperiment
    Error 4 error C2512: 'Microsoft::WRL::ComPtr' : no appropriate default constructor available c:\users\dfran_000\documents\visual studio 2012\projects\httpexperiment\httpexperiment\try_http.cpp 30 1 HTTPExperiment

    The "Quickstart" example doesn't actually tell you what any of the headers or namespaces you need are, and I only got this far by searching for other similar questions, but it seems that I'm still lacking whatever header is needed for CXMLHttpRequest2Callback. Anybody know?

    Thanks!

    Tuesday, August 14, 2012 7:52 PM

Answers

  • I believe CXMLHttpRequest2Callback is provided in the two examples that quickstart is based on (linked in the first paragraph) - e.g. XML HTTP Request 2 GET  sample.  The quickstart is based on those samples and the code snippets are taken directly from them. 


    Tuesday, August 14, 2012 10:22 PM

All replies

  • I believe CXMLHttpRequest2Callback is provided in the two examples that quickstart is based on (linked in the first paragraph) - e.g. XML HTTP Request 2 GET  sample.  The quickstart is based on those samples and the code snippets are taken directly from them. 


    Tuesday, August 14, 2012 10:22 PM
  • I believe CXMLHttpRequest2Callback is provided in the two examples that quickstart is based on (linked in the first paragraph) - e.g. XML HTTP Request 2 GET sample.  The quickstart is based on those samples and the code snippets are taken directly from them. 


    I searched all over in the mentioned sample project, CXMLHttpRequest2Callback does not exist in it. Is there any other answer to the original CrownHill's question, as I have the same problem?

    Thanks!

    Saturday, December 01, 2012 11:25 AM
  • Go to the sample and "Browse Code":

    http://code.msdn.microsoft.com/windowsdesktop/XML-HTTP-request-GET-sample-681d6b1e/view/SourceCode#content

    It's in XMLHttpRequest2Callback.h and .cpp.

    Saturday, December 01, 2012 4:01 PM