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

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

本文简介:选择自 3996906 的 blog

        if(!disp)
                return rtn;

        htmldoc2 = disp;
        htmldoc2->get_all(&htmlelemcoll);
        htmlelemcoll->item(tvariant(itemname),tvariant(0),&disp);
        htmlelem = disp;
        tvariant val;
        htmlelem->getattribute(widestring("value"),0,&val);
        rtn = val.bstrval;

        return rtn;
}

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

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

        htmldoc2 = disp;

        htmldoc2->get_all(&htmlelemcoll);
        htmlelemcoll->item(tvariant(itemname),tvariant(0),&disp);
        htmlelem = disp;
        htmlelem->setattribute(widestring("value"),tvariant(value),0);
}

void tfrmaddfriend::addfriendonclick(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 ws;
        bool flag;
        ws.setlength(64);
        htmlelem->get_tagname(&ws);
        if(ws == widestring("img"))
        {
                tvariant val;
                htmlelem->getattribute(widestring("name"),0,&val);

                ansistring str;
                str = val.bstrval;
                if(str == widestring("closeform"))
                {
                        this->close();
                }
                else if(str == widestring("minform"))
                {

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

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

go top