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

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

本文简介:选择自 3996906 的 blog

//---------------------------------------------------------------------------
#include <classes.hpp>
#include <controls.hpp>
#include <stdctrls.hpp>
#include <forms.hpp>
#include "shdocvw_ocx.h"
#include <olectrls.hpp>
//---------------------------------------------------------------------------
class tfrmaddfriend : public tform
{
__published: // ide-managed components
        tcppwebbrowser *cppwebbrowseraddfriend;
        void __fastcall formcreate(tobject *sender);
        void __fastcall cppwebbrowseraddfrienddocumentcomplete(tobject *sender,
          lpdispatch pdisp, variant *url);
        void __fastcall formdestroy(tobject *sender);
private:
        void moveformevt(dispid id, variant* pvarresult);
        void moveform(void);
        void maskevt(dispid id, variant* pvarresult);
        void setbrowserstyle(void);
        void cancelevt(void);
        void releasehook(void);
        void addfriendonclick(dispid id, variant* pvarresult);
        ansistring getinputvalue(ansistring itemname);
        void onkeypressevt(dispid id, variant* pvarresult);
        void setfocusinput(ansistring itemname);
        void putinputvalue(ansistring itemname, ansistring value); // user declarations
public:  // user declarations
        ansistring mbnum;
        ansistring friendname;
        ansistring id8751;
        ansistring info;
        __fastcall tfrmaddfriend(tcomponent* owner);
};
//---------------------------------------------------------------------------
extern package tfrmaddfriend *frmaddfriend;
//---------------------------------------------------------------------------
#endif

.cpp
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "addfriendform.h"
#include "globalfunc.h"
#include "globalvar.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "shdocvw_ocx"
#pragma resource "*.dfm"
tfrmaddfriend *frmaddfriend;
//---------------------------------------------------------------------------
__fastcall tfrmaddfriend::tfrmaddfriend(tcomponent* owner)
        : tform(owner)
{
}
//---------------------------------------------------------------------------
void __fastcall tfrmaddfriend::formcreate(tobject *sender)
{
        this->cppwebbrowseraddfriend->handleneeded();
        this->cppwebbrowseraddfriend->navigate(widestring(getrespath("addfriends.htm")),null,null,null,null);

        cutformrgn(handle,316,225);
}
//---------------------------------------------------------------------------
void tfrmaddfriend::moveformevt(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);

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

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

go top