CB6中使用浏览器控件的一些操作[5]

[入库:2005年8月19日] [更新:2007年3月24日]

本文简介:选择自 3996906 的 blog

        htmlwnd2->get_event(&htmlevt);

        htmlevt->get_srcelement(&htmlelem);

        widestring _tag;

        htmlelem->get_tagname(&_tag);

        long btn,_x,_y;
        htmlevt->get_button(&btn);
        htmlevt->get_screenx(&_x);
        htmlevt->get_screeny(&_y);

        if(_tag == widestring("td") && btn == 1)
        {
                ::releasecapture();
                ::sendmessage(handle,wm_nclbuttondown,htcaption,makelparam(_x,_y));
        }
        pvarresult->vt = vt_bool;
        pvarresult->boolval = false;
}

void tfrmaddfriend::moveform(void)
{
        //todo: add your source code here
        _di_idispatch disp;
        system::delphiinterface<ihtmldocument2> htmldoc2;
        system::delphiinterface<ihtmlelementcollection> htmlelemcoll;
        system::delphiinterface<ihtmlelement> htmlelem;

        disp = this->cppwebbrowseraddfriend->document;
        if(!disp)
                return;

        htmldoc2 = disp;
        htmldoc2->get_all(&htmlelemcoll);
        htmlelemcoll->item(tvariant("moveform"),tvariant(0),&disp);
        htmlelem = disp;

        tvariant onfrmmosusedown;
        onfrmmosusedown = cfunctionobject<tfrmaddfriend>::createeventfunctionobject(this,&tfrmaddfriend::moveformevt,0);
        htmlelem->put_onmousedown(onfrmmosusedown);
}

void tfrmaddfriend::maskevt(dispid id, variant* pvarresult)
{
        //todo: add your source code here
        _di_idispatch disp;
        system::delphiinterface<ihtmldocument2> htmldoc2;
        system::delphiinterface<ihtmlwindow2> htmlwnd2;
        system::delphiinterface<ihtmleventobj> htmlevt;
        system::delphiinterface<ihtmlelement> htmlelem;

        disp = this->cppwebbrowseraddfriend->document;
       
        if(!disp)
                return;

        htmldoc2 = disp;
        htmldoc2->get_parentwindow(&htmlwnd2);
        htmlwnd2->get_event(&htmlevt);

        htmlevt->get_srcelement(&htmlelem);

        widestring _tag;

        htmlelem->get_tagname(&_tag);
        if(_tag == widestring("input"))
                return;

        pvarresult->vt = vt_bool;
        pvarresult->boolval = false;
}

void tfrmaddfriend::cancelevt(void)
{
        //todo: add your source code here
        _di_idispatch disp;
        system::delphiinterface<ihtmldocument2> htmldoc2;
        system::delphiinterface<ihtmlelement> htmlelem;

本文关键:CB6中使用浏览器控件的一些操作
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top