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

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

本文简介:选择自 3996906 的 blog

        system::delphiinterface<ihtmleventobj> htmlevt;

        disp = this->cppwebbrowseraddfriend->document;
        if(!disp)
                return;
               
        htmldoc2 = disp;
        htmldoc2->get_parentwindow(&htmlwnd2);
        htmlwnd2->get_event(&htmlevt);

        long key;
        htmlevt->get_keycode(&key);

        if(int(key) == 13)
        {
                this->mbnum = this->getinputvalue("mbnum");
                this->friendname = this->getinputvalue("name");
                this->id8751 = this->getinputvalue("id");
                this->info = this->getinputvalue("memtextarea");
                this->modalresult = mrok;
                this->close();
                pvarresult->vt = vt_bool;
                pvarresult->boolval = false;
        }
        if(int(key) == 27)
        {
                this->close();
                pvarresult->vt = vt_bool;
                pvarresult->boolval = false;
        }
}

void tfrmaddfriend::setfocusinput(ansistring itemname)
{
        //todo: add your source code here
        _di_idispatch disp;
        system::delphiinterface<ihtmldocument2> htmldoc2;
        system::delphiinterface<ihtmlelementcollection> htmlelemcoll;
        system::delphiinterface<ihtmlelement2> htmlelem2;

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

        htmldoc2 = disp;
        htmldoc2->get_all(&htmlelemcoll);
        htmlelemcoll->item(tvariant(itemname),tvariant(0),&disp);

        if(!disp)
                return;

        htmlelem2 = disp;
        htmlelem2->focus();
}


void __fastcall tfrmaddfriend::formdestroy(tobject *sender)
{
        this->releasehook();       

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

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

go top