一般是如何同IE通信,有相关的COM接口吗,哪位有资料能否给小弟一份
[email protected]
[email protected]
解决方案 »
- 如何学好数据结构
- 能简化吗 if ((aaa = 2) or (aaa=6) or (aaa=7) or (aaa=9)) then
- 哪位大哥帮我写个小函数,应该挺简单的
- 请问:ADOQuery 的 locate 方法是做什么用的?
- ntohl函数起什么作用?
- 想将image1的图片的路径和文件名(用日期时间表示:20050622085227.bmp)保存到数据库,怎样取得这个image1的路径和文件名?
- SQL语句中如何实现增加临时字段
- 在DELPHI7中如何调用系统目录下netapi32.dll里面的函数NetMessageBufferSend
- 用SQL将表字段改名问题:
- 如何将硬盘上的某个目录虚拟成光驱
- 我装的DELPHI7.0不知为何在区域设置为“英文”是看到的汉字都成了“????”?
- 简单菜鸟问题,救命啊!!!在线等待,高分求救
我只是知道个大概
你可以到网上去查找一下
delphi下有ddeman.pas,看看帮助
//前提条件:安装Microsoft shell controls and automation 类型库
//在Delphi中选Project Import Type Library命令,选择Microsoft shell controls and automation 类型库,
//点install后,在ACTIVEX控件板上多了几个组件,把TShell拖到桌面//说明:本人安装Microsoft shell controls and automation 类型库过程中碰到几个小问题,本人用的是
//DELPHI6+WIN2000,就是安装后出现4-6处编译错误:“只读属性不能被赋值”,比如下面就是一处错误:
//procedure TShellLinkObjectProperties.Set_Hotkey(piHK: SYSINT);
//begin
// DefaultInterface.Hotkey := piHK;就是这条语句出错
//end;
//解决办法:用鼠标右击出错处的HOTKEY,选弹出菜单的FIND DECLARATION,你会看到这条语句:
// property Hotkey: SYSINT read Get_Hotkey;原来是因为HOTKEY属性只定义了读方法,没有定义
//写方法,所以编译出错,知道出错原因,改就容易了,把它改成:
// property Hotkey: SYSINT read Get_Hotkey write Set_Hotkey,其中Set_Hotkey出错位置的过程名,
//其它几处错误就按上面的办法修改,成功后,ACTIVEX控件板就多了好几个组件,把TShell拖到桌面
//下面源代码
unit UtIEControl;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleServer, Shell32_TLB, StdCtrls;type
TForm1 = class(TForm)
BtnGetCount: TButton;
Shell1: TShell;
BtnGoHome: TButton;
BtnNavigator: TButton;
BtnClose: TButton;
edtURL: TEdit;
lblURL: TLabel;
procedure BtnGetCountClick(Sender: TObject);
procedure BtnGoHomeClick(Sender: TObject);
procedure BtnNavigatorClick(Sender: TObject);
procedure BtnCloseClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation
uses shdocvw;/////////////
{$R *.dfm}procedure TForm1.BtnGetCountClick(Sender: TObject);
var
shWin:IShellWindows;
begin
shWin:=Shell1.windows as IShellWindows;
showMessage(IntToStr(shWin.get_count));//当前桌面上打开的IE窗口数目
end;procedure TForm1.BtnGoHomeClick(Sender: TObject);
var
shWin:IShellWindows;
wb:IWebBrowser2;
i,j:integer;
begin
shWin:=Shell1.windows as IShellWindows;
i:=shWin.get_count;
if i>0 then
for j:=0 to i-1 do
begin
wb:=shWin.item(j) as IWebBrowser2;
wb.GoHome ;//将当前桌面上打开的所有IE窗口切换到主页
end;
end;procedure TForm1.BtnNavigatorClick(Sender: TObject);
var
shWin:IShellWindows;
wb:IWebBrowser2;
i,j:integer;
flag,url:olevariant;
begin
shWin:=Shell1.windows as IShellWindows;
i:=shWin.get_count;
flag:=0;
url:=edtURL.Text ;
if i>0 then
for j:=0 to i-1 do
begin
wb:=shWin.item(j) as IWebBrowser2;
wb.Navigate2(url,flag,flag,flag,flag);
//将当前桌面上打开的所有IE窗口切换到edtURL指定的页面
end;
end;procedure TForm1.BtnCloseClick(Sender: TObject);
var
shWin:IShellWindows;
wb:IWebBrowser2;
i,j:integer;
begin
shWin:=Shell1.windows as IShellWindows;
i:=shWin.get_count;
if i>0 then
for j:=0 to i-1 do
begin
wb:=shWin.item(j) as IWebBrowser2;
wb.quit;//将当前桌面上打开的所有IE窗口关闭
end;
end;end.
//事实上,有了上述ACTIVEX控件,你可以对IE窗口做任意你想要的控制,具体方法自已研究吧!
//说明,资源管理器窗口也是IE窗口,以上代码同时对资源管理器窗口起作用,如果要区分它们也是很容易
//的