MSXML::IXMLDOMDocument *iXMLDoc = NULL;MSXML::IXMLHttpRequest *iXMLHttp = NULL;HRESULT hr;BSTR bStr = NULL;VARIANT vUserID;VARIANT vPassword;VARIANT vPassValue;VARIANT vAsync;short tEmpty;hr = CoInitializeEx(NULL,COINIT_MULTITHREADED);if(!SUCCEEDED(hr)) return 0;hr = CoCreateInstance (MSXML::CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, MSXML::IID_IXMLDOMDocument, (LPVOID *)&iXMLDoc);if(iXMLDoc){ iXMLDoc->put_async(VARIANT_FALSE); // Smartphone 2002工作区: //删除文档安全选项 IObjectSafety *pSafety; DWORD dwSupported, dwEnabled; if ( SUCCEEDED(iXMLDoc->QueryInterface(IID_IObjectSafety, (void**)&pSafety))) { pSafety->GetInterfaceSafetyOptions( MSXML::IID_IXMLDOMDocument, &dwSupported, &dwEnabled ); pSafety->SetInterfaceSafetyOptions( MSXML::IID_IXMLDOMDocument, dwSupported, 0 ); } iXMLDoc->put_async(VARIANT_FALSE); iXMLDoc->loadXML(L"JoeSmith", &tEmpty);}VariantInit(&vAsync);vAsync.vt = VT_BOOL;vAsync.boolVal = false;VariantInit(&vUserID);vUserID.vt = VT_BSTR;vUserID.bstrVal = L"";VariantInit(&vPassword);vPassword.vt = VT_BSTR;vPassword.bstrVal = L"";VariantInit(&vPassValue);vPassValue.vt = VT_DISPATCH;vPassValue.pdispVal = iXMLDoc;hr = CoInitializeEx(NULL,COINIT_MULTITHREADED); if(!SUCCEEDED(hr)) return 0;hr = CoCreateInstance (MSXML::CLSID_XMLHTTPRequest, NULL, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, MSXML::IID_IXMLHttpRequest, (LPVOID *)&iXMLHttp);iXMLHttp->open(L"GET", L"http://localhost/smartphonesavetest.asp", vAsync,vUserID,vPassword);hr=iXMLHttp->send(vPassValue);iXMLHttp->get_responseText(&bStr); |