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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Anyone has any experience on using CHtmlEditCtrl?

Anyone has any experience on using CHtmlEditCtrl?

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++htmlquestion
2 Posts 2 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.
  • U Offline
    U Offline
    usfesco
    wrote on last edited by
    #1

    CHtmlEditCtrl is a new class introduced since MFC 7.0. It sounds like a great class, which can be used in dialogs for WYSIWYG html editing. But I have a big problem in using CHtmlEditCtrl::SetDocumentHTML after its creation: BOOL CTestDlg::OnInitDialog() { CDialog::OnInitDialog(); CString str = "<html>My page<p>test</p></html>"; CHtmlEditCtrl* m_pHtmlEditor = new CHtmlEditCtrl(); m_pHtmlEditor ->Create("",0,CRect(10,10,200,200),this,IDC_HTMLEDITOR); // put some html code in it m_pHtmlEditor->SetDocumentHTML(str); return TRUE; } Everything looks good, but when I run the app, the HTML code in "str" does not show up in the HTML Editor window :(( i.e., the html editor window is blank after the dialog appears on the screen. What's more "interesting" (and frustrating) is, if I put a MessageBox before m_pHtmlEditor->SetDocumentHTML(str); i.e., change the code to: BOOL CTestDlg::OnInitDialog() { CDialog::OnInitDialog(); CString str = "<html>My page<p>test</p></html>"; CHtmlEditCtrl* m_pHtmlEditor = new CHtmlEditCtrl(); m_pHtmlEditor ->Create("",0,CRect(10,10,200,200),this,IDC_HTMLEDITOR); **AfxMessageBox("test");** // put some html code in it m_pHtmlEditor->SetDocumentHTML(str); return TRUE; } It then works! The HTML code in "str" is showing up in the HTML editor window. But I really don't need that MessageBox. Anybody has any idea? I am really stuck. I can provide a link to my test project if anyone needs it. Big thanks! :rose:

    D 1 Reply Last reply
    0
    • U usfesco

      CHtmlEditCtrl is a new class introduced since MFC 7.0. It sounds like a great class, which can be used in dialogs for WYSIWYG html editing. But I have a big problem in using CHtmlEditCtrl::SetDocumentHTML after its creation: BOOL CTestDlg::OnInitDialog() { CDialog::OnInitDialog(); CString str = "<html>My page<p>test</p></html>"; CHtmlEditCtrl* m_pHtmlEditor = new CHtmlEditCtrl(); m_pHtmlEditor ->Create("",0,CRect(10,10,200,200),this,IDC_HTMLEDITOR); // put some html code in it m_pHtmlEditor->SetDocumentHTML(str); return TRUE; } Everything looks good, but when I run the app, the HTML code in "str" does not show up in the HTML Editor window :(( i.e., the html editor window is blank after the dialog appears on the screen. What's more "interesting" (and frustrating) is, if I put a MessageBox before m_pHtmlEditor->SetDocumentHTML(str); i.e., change the code to: BOOL CTestDlg::OnInitDialog() { CDialog::OnInitDialog(); CString str = "<html>My page<p>test</p></html>"; CHtmlEditCtrl* m_pHtmlEditor = new CHtmlEditCtrl(); m_pHtmlEditor ->Create("",0,CRect(10,10,200,200),this,IDC_HTMLEDITOR); **AfxMessageBox("test");** // put some html code in it m_pHtmlEditor->SetDocumentHTML(str); return TRUE; } It then works! The HTML code in "str" is showing up in the HTML editor window. But I really don't need that MessageBox. Anybody has any idea? I am really stuck. I can provide a link to my test project if anyone needs it. Big thanks! :rose:

      D Offline
      D Offline
      Debapritam Chakra
      wrote on last edited by
      #2

      Did you find any solution for this problem??

      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