您好:
不好意思又要打扰您,上次的那个问题,我现在由遇到了新问题;
首先;
void TestDlg::OnBClick() 
{
  //开始一个线程
   AfxBeginThread(TestAdd,...,THREAD_PRIORITY_NORMAL);}
UINT TestAdd(LPVOID pParam) //线程函数
{
.................
 IDispatch* pdisp;
 HRESULT hr1=pXMLDoc->QueryInterface(IID_IDispatch, (void**&pdisp);
 VariantInit(&vRequest);
 vRequest.vt=VT_DISPATCH;
 vRequest.pdispVal=pdisp;
 PAddNew->Parent=this;
 HttpXML->open("POST", "http://192.168.0.2/Test.asp",false);
 HttpXML->send(vRequest); ---在这里就会有问题
 
}
弹出的错误是:
Debug Err!
abnomal program termination
能不能再帮我解决这个问题!

解决方案 »

  1.   

    Here is a sample of XMLHTTP.post
    #include "stdafx.h"
    #import "msxml.dll"
    #import "msxml2.dll"
    #include "Atlbase.h"
    using namespace MSXML2;
    int main(int argc, char* argv[])
    {
    printf("Test of XMLHTTP by masterz!\n");
    CoInitialize(NULL);
    try
    {
    IXMLHTTPRequestPtr xmlrequest;
    //xmlrequest.CreateInstance("Msxml2.XMLHTTP");
    xmlrequest.CreateInstance(__uuidof(XMLHTTP));
    CComVariant vFalse(FALSE);
    CComVariant vNull(NULL);
    xmlrequest->open("POST", 
    _bstr_t("http://211.157.102.21/member/logon.asp"),vFalse,vNull,vNull);
    xmlrequest->setRequestHeader("Content-Type:","application/x-www-form-urlencoded\r\n");
    _bstr_t bsdata("name=******&pass=*********&type=1");//use your login name and password
    xmlrequest->send(_variant_t(bsdata));

    BSTR bstrbody;
    xmlrequest->get_responseText(&bstrbody);
    _bstr_t bstrtbody(bstrbody);
    printf("%s\n",(LPCTSTR)bstrtbody);
    //MessageBox(0,bstrtbody,"",MB_OK);

    }
    catch (_com_error &e)
    {
    printf("Description = '%s'\n", (char*) e.Description());
    }
    CoUninitialize();
    printf("program end\n");
    return 0;
    }
    I suggest you post your problem with a more meaningful caption. put my id in the caption may discourage others from helping you.
      

  2.   

    you are posting xml document, so try
    xmlrequest->setRequestHeader( "Content-type", "text/xml"); 
    xmlrequest->send(...);