DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: will123wi
今日帖子: 21
在线用户: 7
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 bios (阿贡) ★☆☆☆☆ -
盒子中级会员
2004/2/18 17:02:25
标题:
sephil老大?来来来! 浏览:1239
加入我的收藏
楼主: //---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
#include "SHDocVw_OCX.h"
#include <Mshtml.h>
#include <mshtmhst.h>
#include <mshtmcid.h>
#include <OleCtrls.hpp>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "SHDocVw_OCX"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
void TForm1::ExecWBEx(int cmdID,TVariant *pvaIn,TVariant *pvaOut,int nCmdExecOpt)
{
    IDispatch * WebDocument = static_cast<IDispatch *>(CppWebBrowser->Document);
    IHTMLDocument2 *HTMLDocument = static_cast<IHTMLDocument2 *>(WebDocument);
    if(HTMLDocument)
    {
        IOleCommandTarget *pCmd;
        HRESULT hr=HTMLDocument->QueryInterface(IID_IOleCommandTarget,(void **)(&pCmd));
        if(SUCCEEDED(hr))
        {
            pCmd->Exec(&CGID_MSHTML,cmdID,nCmdExecOpt,pvaIn,pvaOut);
        }
    }
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
String URL="http://127.0.0.1";
TVariant V = URL;
CppWebBrowser->Navigate2(&V);
TVariant *abc;
 ExecWBEx(IDM_FIND,abc,abc,0);  //想调用ie的查找框,但发现DLL错误!
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormShow(TObject *Sender)
{
OleInitialize(0); 
        
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormDestroy(TObject *Sender)
{
OleUninitialize();        
}
//---------------------------------------------------------------------------

此帖子包含附件:
JPEG 图像
大小:46.4K
----------------------------------------------
按此在新窗口浏览图片
按此在新窗口浏览图片
作者:
男 sephil (NAILY Soft) ★☆☆☆☆ -
盒子中级会员
2004/2/18 17:36:00
1楼: 手上没机子
没整好
----------------------------------------------
Copyright 2008 ? NAILY Soft

Click here to redirect to my home
Click here to redirect to my blog
作者:
男 bios (阿贡) ★☆☆☆☆ -
盒子中级会员
2004/2/18 17:39:01
2楼: 老大 修好了,帮忙哦!
----------------------------------------------
按此在新窗口浏览图片
按此在新窗口浏览图片
作者:
男 sephil (NAILY Soft) ★☆☆☆☆ -
盒子中级会员
2004/2/18 17:41:45
3楼: 这几天一直都在整啊
伤心我的资料啊...

----------------------------------------------
Copyright 2008 ? NAILY Soft

Click here to redirect to my home
Click here to redirect to my blog
作者:
男 bios (阿贡) ★☆☆☆☆ -
盒子中级会员
2004/2/23 14:37:22
4楼: 老大 有在帮偶么?
----------------------------------------------
按此在新窗口浏览图片
按此在新窗口浏览图片
作者:
男 sephil (NAILY Soft) ★☆☆☆☆ -
盒子中级会员
2004/2/24 10:10:02
5楼: 没有错阿
----------------------------------------------
Copyright 2008 ? NAILY Soft

Click here to redirect to my home
Click here to redirect to my blog
作者:
男 sephil (NAILY Soft) ★☆☆☆☆ -
盒子中级会员
2004/2/24 10:10:35
6楼: //---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
    OleInitialize(NULL);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormDestroy(TObject *Sender)
{
    OleUninitialize();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    WB->Navigate2(&(TVariant)"http://www.playicq.com");    
}
//---------------------------------------------------------------------------

void ExecWBEx(TCppWebBrowser* pWB, int cmdID, TVariant* pvaIn, TVariant* pvaOut, int nCmdExecOpt)
{
    IDispatch* pWBDoc = static_cast<IDispatch*>(pWB->Document);
    IHTMLDocument2* doc = static_cast<IHTMLDocument2 *>(pWBDoc);
    if( doc )
    {
        IOleCommandTarget* pCmd;
        HRESULT hr = doc->QueryInterface(IID_IOleCommandTarget,(void**)(&pCmd));
        if( SUCCEEDED(hr) )
            pCmd->Exec(&CGID_MSHTML, cmdID, nCmdExecOpt, pvaIn, pvaOut);
    }
}

void __fastcall TForm1::Button2Click(TObject *Sender)
{
    TVariant EmptyParam;
    ExecWBEx(WB, IDM_FIND, &EmptyParam, &EmptyParam, 0);
}
//---------------------------------------------------------------------------
----------------------------------------------
Copyright 2008 ? NAILY Soft

Click here to redirect to my home
Click here to redirect to my blog
作者:
男 bios (阿贡) ★☆☆☆☆ -
盒子中级会员
2004/2/24 11:25:03
7楼: 晕啊 老大 这回可以了!
不过很奇怪要点两次才出来的呀!晕!
----------------------------------------------
按此在新窗口浏览图片
按此在新窗口浏览图片
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行78.125毫秒 RSS