본문 바로가기
IT-개발,DB

[개발/VC] 클릭했을때 이벤트 얻기

by SB리치퍼슨 2011. 9. 27.
클릭했을때 이벤트 얻기

You may also have to include an entry in the dispatch map: (CHtmlEditView is
a class I have derived from CHtmlView )

BEGIN_DISPATCH_MAP(CHtmlEditView, CCmdTarget)
  DISP_FUNCTION_ID(CHtmlEditView, "onclick",
DISPID_HTMLDOCUMENTEVENTS_ONCLICK,
                                          OnClick, VT_BOOL, VTS_NONE)
END_DISPATCH_MAP()

VARIANT_BOOL CHtmlEditView::OnClick()
{
     MSHTML::IHTMLWindow2Ptr  spWin2;
     MSHTML::IHTMLEventObjPtr spEventObj;
     MSHTML::IHTMLElementPtr  spEle;
     MSHTML::IHTMLDocument2Ptr spDoc2 = NULL;

     m_pBrowserApp->get_Document( (IDispatch**)&spDoc2 );

     spWin2 = m_spDoc2->GetparentWindow();

     spEventObj = spWin2->Getevent();

     spEle = spEventObj->GetsrcElement(); // returns the element "clicked" on

    return VARIANT_TRUE;
}
반응형

댓글