Author: Tomas Rutkauskas
Detect the current URL in Internet Explorer
Answer:
You can quickly retrieve the current Internet Explorer's URL with DDE.
There are a few problems with this technique:
multiple instances of IE could be open - you have no control to which one you
connect
one instance with multiple windows could be open (created with IE's menu File | New
| Window). Again, you have no control which one you connect to.
Ultimately, you could use EnumChildWindows() calls to check for any open IE window.
This could would have to be customized for each new IE release..
1 uses2 DDEMan;
3 4 // TForm type declaration...5 6 procedure TForm1.Button1Click(Sender: TObject);
7 var8 DDE: TDDEClientConv;
9 begin10 DDE := TDDEClientConv.Create(self);
11 if DDE.SetLink('IExplore', 'WWW_GetWindowInfo') then12 Memo1.Lines.Add(DDE.RequestData('0xFFFFFFFF,sURL,sTitle'));
13 DDE.Free;
14 end;