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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Problem about IHTMLDocument2->wirte() , plz !

Problem about IHTMLDocument2->wirte() , plz !

Scheduled Pinned Locked Moved C / C++ / MFC
helpdebuggingquestion
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Leesen
    wrote on last edited by
    #1

    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); } }

    L 1 Reply Last reply
    0
    • 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); } }

      L Offline
      L Offline
      Leesen
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

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