Mega Code Archive

 
Categories / Delphi / Examples
 

Detect the current url in internet explorer [dde]

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.. uses DDEMan; // TForm type declaration... procedure TForm1.Button1Click(Sender: TObject); var DDE:TDDEClientConv; begin DDE:=TDDEClientConv.Create(self); if DDE.SetLink('IExplore','WWW_GetWindowInfo') then Memo1.Lines.Add(DDE.RequestData('0xFFFFFFFF,sURL,sTitle')); DDE.Free; end;