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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
L

Leesen

@Leesen
About
Posts
50
Topics
27
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Problem about IHTMLDocument2->wirte() , plz !
    L Leesen

    who can give me some tins?? plz, thx very very very much....

    C / C++ / MFC help debugging question

  • Problem about IHTMLDocument2->wirte() , plz !
    L Leesen

    I have written a program which reads data from internet and displays it in the web browser control. And now I'm fuzz about such problems( I have paste the code at the end): Sometimes the 'DisplayInExplore' works well, but Sometimes it crashs. 1. I have debugged it , and found that 'pHD->write(pSFArray);' method would result in the 'Assert Debug' fatal error. And I can't step into the method write. 2. Sometimes, the 'pHD->write(pSFArray);' could execute successfully, but there was no data to display in the Web Browser control. And when cursor went into the client area of the Web Browser control, the cursor change to the 'wait' status. So , I have no idea why it works so instable ? Or there are some errors in my function? Plz give me some suggestion ,Thx. --------------------------------------------------------------------------- The code is as below: void CGameInfoDlg::DisplayInExplore(CString strContent) { //m_exploreView is the CWebBrowser2 IHTMLDocument2* pHD=(IHTMLDocument2*) m_exploreView.GetDocument(); VARIANT* pVATable=NULL; SAFEARRAY* pSFArray; pSFArray = SafeArrayCreateVector(VT_VARIANT, 0, 1); if(pSFArray!=NULL && pHD!=NULL) { SafeArrayAccessData(pSFArray,(LPVOID*) &pVATable); BSTR bstrContent=strContent.AllocSysString(); pVATable->vt=VT_BSTR; pVATable->bstrVal=bstrContent; SafeArrayUnaccessData(pSFArray); pHD->write(pSFArray); } else { MessageBox("Errors!"); } SysFreeString(pVATable->bstrVal); if(pSFArray!=NULL) { SafeArrayDestroy(pSFArray); } }

    C / C++ / MFC help debugging question

  • ATL & DHTML
    L Leesen

    You mean insert code in the HTML ?? My intention is to fire the Event in the ActiveX control . Thus , web designer without konwing about the Activex can simply using "" tag to deploy the ActiveX.

    C / C++ / MFC c++ html help

  • ATL & DHTML
    L Leesen

    I have tried by your advice. But it sitll not work. And I set the default method. [id(0), helpstring("method Prompt")] HRESULT ShowMsg(); The DHTML will invoke the default method with DISPID=0; It still not work. Have you any source code which can run smoothly .Could you send me for reference ? Thank You. Email: fengrux@hotmail.com

    C / C++ / MFC c++ html help

  • ATL & DHTML
    L Leesen

    I write an ATL control to implement the onunload event of the html. I set the onunload handle through IHTMLBodyElement. But it did not work. Source code as follow: //definition of IDHTMLTest2 in IDL interface IDHTMLTest2 : IDispatch { [id(1), helpstring("method ShowMsg")] HRESULT ShowMsg(); }; //selection of the source code CComPtrspIE; m_spClientSite->GetContainer(&spIE); CComQIPtrspDoc(spIE); if (spDoc){ CComPtr spElement; spDoc->get_body(&spElement); CComQIPtr spBody(spElement); IDispatch* pShowMsg; QueryInterface(IID_IDHTMLTest2,(void**)&pShowMsg); VARIANT v; v.vt=VT_DISPATCH; v.pdispVal=pShowMsg; //this event can't be invoke ,when close the ie-window spBody->put_onunload(v); //this invoke works well ((IDHTMLTest2*)pShowMsg)->ShowMsg(); //code below can works well // v.vt=VT_BSTR; // v.bstrVal = L"#DA70D6"; // spBody->put_bgColor(v); } Thank you for your advanced help. Regards.

    C / C++ / MFC c++ html help

  • ATL & DHTML
    L Leesen

    I write an ATL control to implement the OnUnLoad event of the html. I set the OnUnload handle through IHTMLBodyElement. But it did not work. Source code as follow: //definition of IDHTMLTest2 in IDL interface IDHTMLTest2 : IDispatch { [id(1), helpstring("method ShowMsg")] HRESULT ShowMsg(); }; //selection of the source code CComPtrspIE; m_spClientSite->GetContainer(&spIE); CComQIPtrspDoc(spIE); if (spDoc){ CComPtr spElement; spDoc->get_body(&spElement); CComQIPtr spBody(spElement); IDispatch* pShowMsg; QueryInterface(IID_IDHTMLTest2,(void**)&pShowMsg); VARIANT v; v.vt=VT_DISPATCH; v.pdispVal=pShowMsg; //this event can't be invoke ,when close the ie-window spBody->put_onunload(v); //this invoke works well ((IDHTMLTest2*)pShowMsg)->ShowMsg(); //code below can works well // v.vt=VT_BSTR; // v.bstrVal = L"#DA70D6"; // spBody->put_bgColor(v); } Thank you for your advanced help. Regards.

    ATL / WTL / STL c++ html help

  • how to debug visual com dll ??
    L Leesen

    hi But how can I solve this problem . You know ,anyway ,if the program have such a bug ,my boss will not be satisfactory with me. I have try many times these days, but failed. Can you give me some advice on how to resolve this problem. It'll be appreciated. thx. regards.

    COM help c++ question com debugging

  • how to debug visual com dll ??
    L Leesen

    hi, thx. I can debug the com dll following your advice. Because just when my vb program exit the errors occurrs, I set breakpoints in destructor function . Then when I exit the vb program ,it seemed the program did not execute the destructor code. It did not pause on the breakpoints,instead there showed a error dialog "Unhandled exception in P2P.exe : Access Violation". If I direct run the vb program without the debug mode , when I exit the vb program I will receive such error message"the memory address can't be read..." why?? I am exhausting now after so much try. thx. regards.

    COM help c++ question com debugging

  • how to debug the com ???
    L Leesen

    hi, thx. I can debug the com dll following your advice. Because just when my vb program exit the errors occurrs, I set breakpoints in destructor function . Then when I exit the vb program ,it seemed the program did not execute the destructor code. It did not pause on the breakpoints,instead there showed a error dialog "Unhandled exception in P2P.exe : Access Violation". If I direct run the vb program without the debug mode , when I exit the vb program I will receive such error message"the memory address can't be read..." why?? I am exhausting now after so much try. thx. regards.

    C / C++ / MFC help c++ question com debugging

  • how to debug the com ???
    L Leesen

    thx . It really do well accroding to your suggestion . But when I am in debug mode . I press "F5" to debug , the error dialog show "User breakpoint called from code at 0x77f9f9df",then the vc code change into assemble code . And in that way I can't debug further. And how ??

    C / C++ / MFC help c++ question com debugging

  • how to debug Visual Com Dll
    L Leesen

    hi,all I write a COM Dll in Visual ATL . And I refer the COM dll in VB environment. The vb program runs well except when the program exit, the error dialog occur. The error info are such as "the address can't read ..." . Is it concerns with the c++ pointer ??? But how can I find the actuall false?? Are there any tools to help to debug the com dll?? The problem disturb me for very long time . Ask for your help , please ! Regards.

    Visual Basic help c++ question com debugging

  • how to debug visual com dll ??
    L Leesen

    hi,all I write a COM Dll in Visual ATL . And I refer the COM dll in VB environment. The vb program runs well except when the program exit, the error dialog occur. The error info are such as "the address can't read ..." . Is it concerns with the c++ pointer ??? But how can I find the actuall false?? Are there any tools to help to debug the com dll?? The problem disturb me for very long time . Ask for your help , please ! Regards.

    COM help c++ question com debugging

  • how to debug the com ???
    L Leesen

    hi,all I write a COM Dll in Visual ATL . And I refer the COM dll in VB environment. The vb program runs well except when the program exit, the error dialog occur. The error info are such as "the address can't read ..." . Is it concerns with the c++ pointer ??? But how can I find the actuall false?? Are there any tools to help to debug the com dll?? The problem disturb me for very long time . Ask for your help , please ! Regards.

    C / C++ / MFC help c++ question com debugging

  • ATL Problems ?
    L Leesen

    I am a newer to ATL. I think I just return a pointer to another COM object . STDMETHODIMP CTeacher::get_OneStudent(IStudent *pVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) // TODO: Add your implementation code here *pVal = * m_aStudent; return S_OK; } STDMETHODIMP CTeacher::put_OneStudent(IStudent *newVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) // TODO: Add your implementation code here *m_aStudent = *newVal ; return S_OK; }

    C / C++ / MFC c++ com testing tools

  • Some ATL Problems ?? Ask for help
    L Leesen

    Hi, all Some problems about ATL Com: 1.I have create two ATL Object: CStudent and CTeacher . The simple source code listed as follow: (some code auto generated by ATL have been skiped) class CStudent { private: long m_age; public: CStudent():m_age(10) { } //...other code auto generated by ATL }; class CTeacher { private: IStudent* m_aStudent; public: CTeacher() { //create an instance of the com CoCreateInstance(CLSID_Student,NULL,CLSCTX_ALL,IID_IStudent, (void**)&m_aStudent); } //...other code auto generated by ATL } 2.Then I add a "IStudent * OneStudent" property for ITeacher ,to access the m_aStudent. The implemention of the property are listed as below: STDMETHODIMP CTeacher::get_OneStudent(IStudent *pVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) // TODO: Add your implementation code here *pVal = * m_aStudent; return S_OK; } STDMETHODIMP CTeacher::put_OneStudent(IStudent *newVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) // TODO: Add your implementation code here *m_aStudent = *newVal ; return S_OK; } 3.Now I type some VB code to test the com ,but some compiler errors occurrs. VB Code: Dim s As Student Dim t As New Teacher s = t.OneStudent the last sentence "s = t.OneStudent" have compiler errors. Errors:function or interface marked as restricted ,or the function use an Automation type not supported in Visual Basic I guess the errors caused by the type dismatch between IStudnet and CStudent.But I did not know how to resolve it . So who can tell me how to return the m_aStudent that can be supproted in vb?? thx. Regards.

    C / C++ / MFC help tutorial question c++ com

  • ATL Problems??
    L Leesen

    Hi, all Some problems about ATL Com: 1.I have create two ATL Object: CStudent and CTeacher . The simple source code listed as follow: (some code auto generated by ATL have been skiped) class CStudent { private: long m_age; public: CStudent():m_age(10) { } //...other code auto generated by ATL }; class CTeacher { private: IStudent* m_aStudent; public: CTeacher() { //create an instance of the com CoCreateInstance(CLSID_Student,NULL,CLSCTX_ALL,IID_IStudent, (void**)&m_aStudent); } //...other code auto generated by ATL } 2.Then I add a "IStudent * OneStudent" property for ITeacher ,to access the m_aStudent. The implemention of the property are listed as below: STDMETHODIMP CTeacher::get_OneStudent(IStudent *pVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) // TODO: Add your implementation code here *pVal = * m_aStudent; return S_OK; } STDMETHODIMP CTeacher::put_OneStudent(IStudent *newVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) // TODO: Add your implementation code here *m_aStudent = *newVal ; return S_OK; } 3.Now I type some VB code to test the com ,but some compiler errors occurrs. VB Code: Dim s As Student Dim t As New Teacher s = t.OneStudent the last sentence "s = t.OneStudent" have compiler errors. Errors:function or interface marked as restricted ,or the function use an Automation type not supported in Visual Basic I guess the errors caused by the type dismatch between IStudnet and CStudent.But I did not know how to resolve it . So who can tell me how to return the m_aStudent that can be supproted in vb?? thx. Regards.

    COM c++ com testing tools

  • ATL Problems ?
    L Leesen

    Hi, all Some problems about ATL Com: 1.I have create two ATL Object: CStudent and CTeacher . The simple source code listed as follow: (some code auto generated by ATL have been skiped) class CStudent { private: long m_age; public: CStudent():m_age(10) { } //...other code auto generated by ATL }; class CTeacher { private: IStudent* m_aStudent; public: CTeacher() { //create an instance of the com CoCreateInstance(CLSID_Student,NULL,CLSCTX_ALL,IID_IStudent, (void**)&m_aStudent); } //...other code auto generated by ATL } 2.Then I add a "IStudent * OneStudent" property for ITeacher ,to access the m_aStudent. The implemention of the property are listed as below: STDMETHODIMP CTeacher::get_OneStudent(IStudent *pVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) // TODO: Add your implementation code here *pVal = * m_aStudent; return S_OK; } STDMETHODIMP CTeacher::put_OneStudent(IStudent *newVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) // TODO: Add your implementation code here *m_aStudent = *newVal ; return S_OK; } 3.Now I type some VB code to test the com ,but some compiler errors occurrs. VB Code: Dim s As Student Dim t As New Teacher s = t.OneStudent the last sentence "s = t.OneStudent" have compiler errors. Errors:function or interface marked as restricted ,or the function use an Automation type not supported in Visual Basic I guess the errors caused by the type dismatch between IStudnet and CStudent.But I did not know how to resolve it . So who can tell me how to return the m_aStudent that can be supproted in vb?? thx. Regards.

    C / C++ / MFC c++ com testing tools

  • ATL Problems ??? Ask for help !
    L Leesen

    Hi, all Some problems about ATL Com: 1.I have create two ATL Object: CStudent and CTeacher . The simple source code listed as follow: (some code auto generated by ATL have been skiped) class CStudent { private: long m_age; public: CStudent():m_age(10) { } //...other code auto generated by ATL }; class CTeacher { private: IStudent* m_aStudent; public: CTeacher() { //create an instance of the com CoCreateInstance(CLSID_Student,NULL,CLSCTX_ALL,IID_IStudent, (void**)&m_aStudent); } //...other code auto generated by ATL } 2.Then I add a "IStudent * OneStudent" property for ITeacher ,to access the m_aStudent. The implemention of the property are listed as below: STDMETHODIMP CTeacher::get_OneStudent(IStudent *pVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) // TODO: Add your implementation code here *pVal = * m_aStudent; return S_OK; } STDMETHODIMP CTeacher::put_OneStudent(IStudent *newVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) // TODO: Add your implementation code here *m_aStudent = *newVal ; return S_OK; } 3.Now I type some VB code to test the com ,but some compiler errors occurrs. VB Code: Dim s As Student Dim t As New Teacher s = t.OneStudent the last sentence "s = t.OneStudent" have compiler errors. Errors:function or interface marked as restricted ,or the function use an Automation type not supported in Visual Basic I guess the errors caused by the type dismatch between IStudnet and CStudent.But I did not know how to resolve it . So who can tell me how to return the m_aStudent that can be supproted in vb?? thx. Regards.

    COM help tutorial question c++ com

  • Some ATL Problems ?? Ask for help
    L Leesen

    And how can I construct the CStudent object in CTeacher. Details as follows. In the construction function of the CTeacher : CTeacher() { IStudent * m_student =new CStudent(); return; } There are some compiler errors. It says that the CStudent cannot instantiate abstract class due to following members:QueryInterface,AddRef,Release. How should I do to resolve the problem. thx. Regards.

    C / C++ / MFC help tutorial question c++ com

  • ATL Problems ??? Ask for help !
    L Leesen

    thank you . Q1 has been resovled following your suggestion. but Q2 remail abcuse. I mean I can not construct the CStudent object in CTeacher. Details as follows. In the construction function of the CTeacher : CTeacher() { IStudent * m_student =new CStudent(); return; } There are some compiler errors. It says that the CStudent cannot instantiate abstract class due to following members:QueryInterface,AddRef,Release. How should I do to resolve the problem. thx. Regards.

    COM help tutorial question c++ com
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups