如何得知当前IE窗口的URL地址和TITLE

liguang 2000-03-14 10:23:00
请问如何判断当前活动窗口是否是IE窗口,如果是的话.怎么得到这个IE窗口当前正在浏览的网址的URL地址和相对应的TITLE.
...全文
413 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
2001-04-14
  • 打赏
  • 举报
回复
Lin(林),你给的地址是个英文网站 呀,没中文的吗我的英文不行
All Products | Support | Search | microsoft.com Guide Home | Magazines | Libraries | Developer Centers | Resources | Downloads | Code | Search MSDN |

--------------------------------------------------------------------------------
Downloads
MS Product Catalog
Microsoft Accessibility

--------------------------------------------------------------------------------
Server Products
Developer Tools
Office Family
Windows Family
MSN

--------------------------------------------------------------------------------
Knowledge Base
Product Support Options
Service Partner Referrals
Year 2000 Compliance

--------------------------------------------------------------------------------
Search microsoft.com
MSN Web Search

--------------------------------------------------------------------------------
microsoft.com Home
MSN Home

--------------------------------------------------------------------------------
Contact Us
Events
Newsletters
Profile Center
Training & Certification
Free E-mail Account

--------------------------------------------------------------------------------
Voices
MSDN Magazine
MSJ
MIND
MSDN Newspaper
.NET Show

--------------------------------------------------------------------------------
MSDN Library
Web Workshop
Code Center
Downloads

--------------------------------------------------------------------------------
BizTalk Server
Commerce Server
DirectX
E-Business
Internet Explorer
.NET Framework & Tools
Office
SQL Server
Visual Studio
Web Services
Windows
XML

More...

--------------------------------------------------------------------------------
Bug Center
DLL Help Database
Support
Newsgroups
Members Helping Members
User Groups
Chats
Training
Events
Developer Books
Component Resources

show toc sync toc index



Web Workshop | Reusing Browser Technology


Browser Extensions

--------------------------------------------------------------------------------

Browser extensions, introduced in Microsoft® Internet Explorer 5, allow developers to add functionality to the browser and enhance the user interface.



Overviews/Tutorials

Adding Explorer Bars This tutorial explains how to add an Explorer Bar in Internet Explorer.
Adding Menu Items This tutorial explains how to add a menu item that runs a Microsoft® Windows® application or that runs a script to the Tools menu or Help menu in Internet Explorer.
Adding Toolbar Buttons This tutorial explains how to add a toolbar button to the Internet Explorer user interface.
Browser Extensions Browser extensions allow developers to provide easy access to their browser enhancements by adding elements (like an Explorer Bar) to the default user interface. Introduced in Internet Explorer 4.0, this feature enables developers to create Explorer Bars and add entries into the standard context menus. Beginning with Internet Explorer 5, this feature allows developers to add entries into the Tools menu and buttons to the toolbar.
Creating Custom Explorer Bars, Tool Bands, and Desk Bands The Explorer Bar was introduced with Internet Explorer 4.0 to provide a display area adjacent to the browser pane. It is basically a child window within the Internet Explorer window, and it can be used to display information and interact with the user in much the same way. Explorer Bars are most commonly displayed as a vertical pane on the left-hand side of the browser pane. However, an Explorer Bar can also be displayed horizontally, below the browser pane.
Customizing the Browser Toolbar This tutorial explains how to customize the appearance of the toolbar area in Internet Explorer.
Explorer Bar Style Guide This guide will help you design Explorer Bars to add to the Microsoft®Internet Explorer user interface.
Toolbar Button Style Guide This guide will help you design icons for toolbar buttons that you add to the Internet Explorer user interface.
Web Accessories Web Accessories are browser enhancements that any developer can create using browser extensions. Users can then add these Web Accessories to their copy of Internet Explorer. By creating Web Accessories, developers have a very powerful way to enable new features and functionality.

Methods

GetBandInfo Retrieves the information for a band object.

Interfaces

IDeskBand IDeskBand is used to obtain information about a band object. See the Creating Custom Explorer Bars, Tool Bands, and Desk Bands article for more information about band objects.

Structures

DESKBANDINFO Contains and receives information for a band object. This structure is used with the IDeskBand::GetBandInfo method.





Back to top
Did you find this topic useful? Suggestions for other topics? Write us!
© 2001 Microsoft Corporation. All rights reserved. Terms of use.
aton 2001-04-14
  • 打赏
  • 举报
回复
还没给分我就来给个详解:
function GetIEFromHWND(WHandle: HWND; var IE: IWebbrowser2): HRESULT;
var
hInst: HWND;
lRes: Cardinal;
MSG: Integer;
pDoc: IHTMLDocument2;
ObjectFromLresult: TObjectFromLresult;
begin
hInst := LoadLibrary('Oleacc.dll');
@ObjectFromLresult := GetProcAddress(hInst, 'ObjectFromLresult');
if @ObjectFromLresult <> nil then begin
try
MSG := RegisterWindowMessage('WM_HTML_GETOBJECT');
SendMessageTimeOut(WHandle, MSG, 0, 0, SMTO_ABORTIFHUNG, 1000, lRes);
Result := ObjectFromLresult(lRes, IHTMLDocument2, 0, pDoc);
if Result = S_OK then
(pDoc.parentWindow as IServiceprovider).QueryService(IWebbrowserApp, IWebbrowser2, IE);
finally
FreeLibrary(hInst);
end;
end;
end;
procedure GetIE(var IE: IWebbrowser2);
var
Wnd: HWND;
WndChild: HWND;
x: Olevariant;
vaClsID, vaEnabled, vaDummy: Olevariant;
begin
Wnd := FindWindow('IEFrame', nil);
//wnd:=GetForegroundWindow;
if Wnd = 0 then
begin
exit;
end;
WndChild := FindWindowEX(Wnd, 0, 'Shell DocObject View', nil);
if WndChild <> 0 then begin
WndChild := FindWindowEX(WndChild, 0, 'Internet Explorer_Server', nil);
if WndChild <> 0 then
begin
GetIEFromHWnd(WndChild, ie);
ShowMessage(ie.LocalUrl);
end;
end;
end;
Kingron 2001-04-02
  • 打赏
  • 举报
回复
用GetActiveWindow()可以取得当前活动的窗口句柄,配合EnumWindow或者FindWindow即可,如果句柄相等,就是活动的IE了,然后GetWindowText() OR Senmessage(h,wm_gettext,.....)都可以取得Title,取得IE地址就麻烦一点儿。
TechnoFantasy 2001-04-01
  • 打赏
  • 举报
回复
需要使用SHDocVW.pas,代码如下:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,ShdocVW,
StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
ListBox1: TListBox;
ListBox2: TListBox;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
xs:IShellWindows;
ib:IWebbrowser2;
i:Integer;
begin
xs:=CoShellWindows.Create;
for i:=0 to xs.Count -1 do begin
ib:=xs.Item(i) as IWebbrowser2;
ListBox1.Items.Add(ib.LocationURL);
ListBox2.Items.Add(ib.LocationName);
end;
end;

end.
引用ShdocVW,建立一个IShellWindows对象,访问其中的成员就可以了。
coldljy 2001-04-01
  • 打赏
  • 举报
回复
可以给分了吧?呵呵。
coldljy 2001-04-01
  • 打赏
  • 举报
回复
//uses DDEMan

procedure TForm1.Button1Click(Sender: TObject);
var
DDE:TDdeClientConv;
begin
DDE:=TDdeClientConv.Create(self);
if DDE.SetLink('IExplore','WWW_GetWindowInfo') then
Label1.Caption:=DDE.RequestData('0xFFFFFFFF,sURL,sTitle')
else
ShowMessage('IE is not running');
DDE.Free;
end;
dana 2001-03-25
  • 打赏
  • 举报
回复
可是取得的url不是当前所选择的IE的URL
比如我现打开多个IE,想取得当前所选择的IE的URL该如何做?
alaclp 2001-03-24
  • 打赏
  • 举报
回复
@@
dana 2001-03-23
  • 打赏
  • 举报
回复
请把源码发给我看一下行吗?
那个站点我也没法上!!!
dana@shd.com.cn
coldljy 2001-03-23
  • 打赏
  • 举报
回复
未经严格测试,如发现问题请贴。
coldljy 2001-03-23
  • 打赏
  • 举报
回复
耗脑细胞无数,终于搞定,呵呵。
用DDE:

//URL:string;
DDE.ServiceApplication:='iexplore';
if DDE.SetLink('iexplore','www_GetWindowInfo') then
URL:=DDE.RequestData('1,0');
Label1.Caption:=URL;
dana 2001-03-23
  • 打赏
  • 举报
回复
拜托了谁能告诉我
Kylixer 2001-03-23
  • 打赏
  • 举报
回复
我也想知道如何得到当前IE窗口的句柄,如各位兄台知道请贴出!
谢谢!
认真关注!
liguang 2000-03-15
  • 打赏
  • 举报
回复
Lin你好,我这里上不MSDN网站啊.你能不能把关键的部分转贴一下啊.谢谢!
Lin 2000-03-14
  • 打赏
  • 举报
回复
请到这个地方去:
http://msdn.microsoft.com/workshop/browser/ext/tutorials/tutorials.asp
olo 2000-03-14
  • 打赏
  • 举报
回复
关注

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧