B
Boblee
Unregistered / Unconfirmed
GUEST, unregistred user!
function GetIEAddress(IEHandle:THandle;var Address:string):Boolean;
Const
CtlNames:array[0..4] of Pchar=(
'WorkerA', //获得IE窗口的工作区的句柄
'ReBarWindow32', //获得IE窗口的菜单栏的句柄
'ComboBoxEx32', //获得IE窗口的下拉菜单的句柄
'ComboBox', //获得IE窗口的下拉菜单当前项的句柄
'Edit' //获得这个下拉菜单的编辑框句柄
);
var
hwnd :Thandle;
i:integer;
AddBuf :array[0..1023] of char;
begin
Result:=True;
hwnd:=IEHandle;
try
for i:=0 to 4 do
showmessage(CtlNames);
hwnd:=FindWindowEx(hwnd,0,CtlNames,nil);
except
Result:=false;
end;
if (Result) then begin
//showmessage('hwnd: ' + inttostr(hwnd));
SendMessage(Hwnd,WM_GETTEXT,1024,Integer(@AddBuf));
ShowMessage('addres:' + AddBuf);
end;
end;
function GetWebSiteInfo():String;
var
pHandle:THandle;
clsName:array[0..224]of char;
ThisUrl: string;
begin
phandle := GetForegroundWindow();
GetClassName(pHandle,clsName,225);//得到当前窗口的类名
showmessage(clsName);
if UpperCase(trim(clsName))='IEFRAME' then//如果是IE的类
begin
GetIEAddress(pHandle,thisurl);
end;
showmessage(thisurl);
end;
Const
CtlNames:array[0..4] of Pchar=(
'WorkerA', //获得IE窗口的工作区的句柄
'ReBarWindow32', //获得IE窗口的菜单栏的句柄
'ComboBoxEx32', //获得IE窗口的下拉菜单的句柄
'ComboBox', //获得IE窗口的下拉菜单当前项的句柄
'Edit' //获得这个下拉菜单的编辑框句柄
);
var
hwnd :Thandle;
i:integer;
AddBuf :array[0..1023] of char;
begin
Result:=True;
hwnd:=IEHandle;
try
for i:=0 to 4 do
showmessage(CtlNames);
hwnd:=FindWindowEx(hwnd,0,CtlNames,nil);
except
Result:=false;
end;
if (Result) then begin
//showmessage('hwnd: ' + inttostr(hwnd));
SendMessage(Hwnd,WM_GETTEXT,1024,Integer(@AddBuf));
ShowMessage('addres:' + AddBuf);
end;
end;
function GetWebSiteInfo():String;
var
pHandle:THandle;
clsName:array[0..224]of char;
ThisUrl: string;
begin
phandle := GetForegroundWindow();
GetClassName(pHandle,clsName,225);//得到当前窗口的类名
showmessage(clsName);
if UpperCase(trim(clsName))='IEFRAME' then//如果是IE的类
begin
GetIEAddress(pHandle,thisurl);
end;
showmessage(thisurl);
end;