Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > WINDOWS PROGRAMMING (NNTP) > IXMLHttpRequest
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 19th May 14:46
bura tino
External User
 
Posts: 1
Default IXMLHttpRequest


Hi,

I can't get the simple snippet of C++ code at the bottom of
http://msdn.microsoft.com/library/en-us/xmlsdk30/htm/xmobjxmlhttprequest.asp?frame=true
to run on my XP VC++ system.

The command hr=pIXMLHTTPRequest.CreateInstance("Msxml2.XMLHTTP ");
never succeeds and an exception is thrown.

Any suggestions?

#import "msxml3.dll"
using namespace MSXML2;

void XMLHttpRequestSample()
{
IXMLHTTPRequestPtr pIXMLHTTPRequest = NULL;
BSTR bstrString = NULL;
HRESULT hr;

try {
hr=pIXMLHTTPRequest.CreateInstance("Msxml2.XMLHTTP ");
SUCCEEDED(hr) ? 0 : throw hr;

hr=pIXMLHTTPRequest->open("GET",
"http://XMLSampleServer/CatalogServer.asp", false);
SUCCEEDED(hr) ? 0 : throw hr;

hr=pIXMLHTTPRequest->send();
SUCCEEDED(hr) ? 0 : throw hr;

bstrString=pIXMLHTTPRequest->responseText;

MessageBox(NULL, _bstr_t(bstrString), _T("Results"), MB_OK);

if(bstrString)
{
::SysFreeString(bstrString);
bstrString = NULL;
}

} catch (...) {
MessageBox(NULL, _T("Exception occurred"), _T("Error"), MB_OK);
if(bstrString)
::SysFreeString(bstrString);
}

}
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666