to elan:bho是什么。能说明一下吗?
我只知道IE的解决方法,以下程序返回前台IE正在访问网页的的URL的TITLE。希望对您能有一些帮助。
//writer by liguang
//in 2000-03-17
unit ligwin1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
control,KeyId:integer;
hotkeyid:ATOM;
public
{ Public declarations }
procedure WMHOTKEY(var Msg:TMessage);message WM_HOTKEY;
end;
var
Form1: TForm1;
ThisUrl
Char;
implementation
{$R *.DFM}
function EnumChildWindowsProc(H:HWnd;lparam:longint):Boolean;stdcall;
var
Buffer: array[0..10] of Char;
begin
Result:=True;
GetClassName(h,buffer,10);
if trim(StrPas(Buffer))='Edit' then
begin
SendMessage(h,WM_GETTEXT,249,Integer(ThisUrl));
Result:=False;
end;
end;
procedure TForm1.WMHOTKEY(var Msg:TMessage);
var
h:HWND;
buffer:array[0..256] of char;
temp:String;
begin
if (Msg.LParamHi=KeyId) and (Msg.LParamLo=control) then
begin
Msg.Result:=1;
h:=GetForegroundWindow;
GetClassName(h,buffer,255);
if StrPas(buffer)='IEFrame' then
begin
EnumChildWindows(h,@EnumChildWindowsProc,0);
GetWindowText(h,buffer,255);
buffer[Pos(' - ',buffer)]:=Char(0);
temp:='当前网页的URL是:'+ThisUrl+#13#10+'当前网页Title是:'+buffer;
MessageBox(h,PChar(temp),'提示信息',MB_OK)
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ThisUrl:=StrAlloc(250);
control:=MOD_CONTROL or MOD_SHIFT ;KeyId:=$43;
hotkeyid:=GlobalAddAtom('UserDefineHotKey')-$C000;
RegisterHotKey(Handle,hotkeyid,control,KeyId);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
UnregisterHotKey(Handle,hotkeyid);
DeleteAtom(hotkeyid);
end;
end.