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
U

User 51754

@User 51754
About
Posts
8
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • IHTMLElementEvents event handling in CHtmlEditView
    U User 51754

    [ Actually IHTMLElementEvents ] All i need do is to capture the onclick ondblclick events for html elements (all have ids)on the CHtmlEditView. I've tried : DISP_FUNCTION_ID(CtestView, "onclick", DISPID_HTMLELEMENTEVENTS2_ONCLICK, OnElementClick, VT_BOOL, VTS_VARIANT) Doesn't work. Tried ON_EVENT etc. Nothing seems to capture the mouse click on the CHtmlEditView in design mode. Any ideas? Thanks Art

    C / C++ / MFC question help tutorial

  • How to modify inserted table in CHtmlEditView
    U User 51754

    Eureka! After some input from TCP folks, I finally arrived at the solution to getting, and modifying a table inserted into an CHtmlEditView: STEP 1: Get the DHTML document to a IDISPATCH STEP 2: Query interface for IID_IHTMLDocument2 STEP 3: get all elements -> IHTMLDocument2::get_all into IHTMLElementCollection STEP 4: Get the item (in this case a table) based on the table id ( _variant_t varID = _bstr_t(L"view"); _variant_t varIdx(0); IDispatch *pDocDisp=NULL; pCollect->item(varID,varIdx, &pDocDisp ); STEP 5: Now query the table item pDocDisp->QueryInterface(IID_IHTMLTable, (void**)&pTable); STEP 6: Now do an insertrow with a IDispatch pointer and -1 for append to end of table Then query the IHTMLTableRow interface IDispatch *pdispRow=NULL; IHTMLTableRow *pRow=NULL; pTable->insertRow ( -1, &pdispRow ); pdispRow->QueryInterface(IID_IHTMLTableRow, (void**)&pRow); STEP 7: Next do an IHTMLTableRow::insertCell with an IDispatch pointer Then query the IHTMLElement interface to get pointer tp IHTMLElement insert a space into the cell do this for the # of columns you have. in my example below i am inserting a row in a 3 column table. IDispatch *pDispCell=NULL; IHTMLElement *pCell=NULL; // col1 pRow->insertCell( -1, &pDispCell ); pDispCell->QueryInterface(IID_IHTMLElement, (void**)&pCell); pCell->put_innerText(L"  "); I'm sure there's a better way - this solution isn't elegant but it works! [ entire code ] IHTMLTable* pTable = NULL; IHTMLElementCollection *pCollect=NULL; _variant_t varID = _bstr_t(L"view"); _variant_t varIdx(0); BSTR tag = SysAllocString(L"0"); long cols = 1; IHTMLDocument2 *pDoc; IDispatch * pDocDisp = NULL; IHTMLTableCaption *pCaption=NULL; pDocDisp = GetHtmlDocument(); HRESULT h = pDocDisp->QueryInterface( IID_IHTMLDocument2, (void**)&pDoc ); pDoc->get_all(&pCollect); pCollect->item(varID,varIdx, &pDocDisp ); pDocDisp->QueryInterface(IID_IHTMLTable, (void**)&pTable); // now insert row and get an IHTMLTableRow pointer IDispatch *pdispRow=NULL; IHTMLTableRow *pRow=NULL; pTable->insertRow ( -1, &pdispRow ); pdispRow->QueryInterface(IID_IHTMLTableRow, (void**)&pRow); pRow->put_align(L"Center"); // Now insert the cell for 3 columns that exist in table already // and get IHTMLElement pointer IDispatch *pDispCell=NULL; IHTMLElement *pCell=NULL; // col1 pRow->insertCell( -

    C / C++ / MFC tutorial database

  • IHTMLElementEvents event handling in CHtmlEditView
    U User 51754

    Does anyone know how to capture IHTMLElementEvent events (onclick) for CHtmlEditView? I've tried ON_EVENT and ON_EVENT_RELFECT - doesn't work. Need to capture events for DISPID_HTMLELEMENTEVENTS2_ONCLICK etc. Must I create a CCmdTarget sub? What and How do i do it. I'm desparately trying to complete my project - any help will be GREATLY appreciated :confused: Thanks Art

    C / C++ / MFC question help tutorial

  • modifiy IHTMLTable via IHTMLCollection
    U User 51754

    After getting the IHTMLCollection, and doing get_all etc, and modifiying the element, the changes to the IHTMLTable don't appear on the CHtmlEditView. Any ideas? IDispatch... GetHtmlDocument(); ...QueryInterface on IHTMLDocument2 pDoc->get_all(&pCollect); pCollect->item(varID,varIdx, &pDocDisp ); pDocDisp->QueryInterface(IID_IHTMLTable, (void**) &pElem); pElem->put_cols(cols); Thanks Art

    C / C++ / MFC question

  • MSHTML Table Insertion using CHtmlEditView
    U User 51754

    Oops - I meant to get the only table element on the page- eventually i will setup element selection. The code works - does one need to update the document somehow ?? so the changes to the table are shown? (fragment) pDoc->get_all(&pCollect); pCollect->item(varID,varIdx, &pDocDisp ); pDocDisp->QueryInterface(IID_IHTMLTable, (void**) &pElem); pElem->put_cols(cols); . . . Thanks again... :-D art

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

  • MSHTML Table Insertion using CHtmlEditView
    U User 51754

    The solution: BSTR bstrText = SysAllocString(L"             "); // TODO: Add your command handler code here IHTMLDocument2 *pDoc; IDispatch * pDocDisp = NULL; pDocDisp = GetHtmlDocument(); HRESULT h = pDocDisp->QueryInterface( IID_IHTMLDocument2, (void**)&pDoc ); BSTR bstrWhere = SysAllocString(L"BeforeEnd"); IHTMLElement *pBody; IHTMLLocation *pLocation; pDoc->get_body( &pBody ); pBody->insertAdjacentHTML( (BSTR)bstrWhere, (BSTR)bstrText); SysFreeString(bstrText); SysFreeString(bstrWhere); pDoc->Release(); pDocDisp->Release(); works fine - putting a table into CHtmlEditView. However how does one access the IHTMLTable interface - when I to get_activeElement I get the body, not the selected table. Thanks. Art

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

  • MSHTML Table Insertion using CHtmlEditView
    U User 51754

    Thanks for the responses. One question - is insertAdjacentHTML feasible for drag drop operation, i.e., a la IDM_TEXTBOX message - simply drops edit box on CHtmlEditView. What I'd ultimately want to do is to be able to insert a table based on parameters entered in dialog, then drop table onto CHtmlEditView. Similar to the DHTMLedit component using IDM_TRIED_INSERTTABLE. Thanks a bunch for responding so quickly. :)

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

  • MSHTML Table Insertion using CHtmlEditView
    U User 51754

    Hello - I'm building a product that requires an html wysiwyg editor - I upgraded to Visual C++ .NET (7) to get MFC 7 - with the CHtmlEditView / CHtmlEditDoc classes, only to find that there is no IDM_TABLE command. I also tried inserting using IHTMLDocument2: BSTR str = SysAllocString(L"   "); IHTMLDocument2 *pDoc; long col=0; IDispatch * pDocDisp = NULL; // get the DOM pDocDisp = GetHtmlDocument(); HRESULT h = pDocDisp->QueryInterface( IID_IHTMLDocument2, (void**)&pDoc ); if( h == S_OK ) { IMarkupServices *pMS = NULL; IMarkupPointer *pMkStart = NULL; IMarkupPointer *pMkFinish = NULL; CComPtr pElement; HRESULT hr = pDoc->createElement(L"TABLE", &pElement); pElement->put_outerHTML(str); pDoc->QueryInterface(IID_IMarkupServices, (LPVOID *) &pMS); //pMS->MovePointersToRange( pMS->InsertElement(pElement, pMkStart, pMkFinish); and also tried IHTMLTable / QueryInterface. None worked. If anyone has a solution to my problem I'd be greateful. Thanks. Art Cote Art Cote

    C / C++ / MFC c++ html csharp help
  • Login

  • Don't have an account? Register

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