DelphiFAQ Home Search:

Detect the current URL in Internet Explorer (DDE)


comments4 comments. Current rating: 5 stars (1 votes). Leave comments and/ or rate it.

You can quickly retrieve the current Internet Explorer's URL with DDE.
There are a few problems with this technique:

  1. multiple instances of IE could be open - you have no control to which one you connect
  2. 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..


// TForm type declaration...

procedure TForm1.Button1Click(Sender: TObject);
  if DDE.SetLink('IExplore','WWW_GetWindowInfo') then


2006-02-25, 11:02:37 from United Kingdom  
Excellent if you want to do this - it's simple and works!
Most useful to me was that is shows how to render a return from the pchar return of DDE.RequestData.
But how do you 'KNOW' what params to send?
'0xFFFFFFFF,sURL,sTitle' is hardly intuitive!
And only the '0xFFFFFFFF' seems to be relevant?
Without the 'sURL, sTitle' the return is the same
But without the '0xFFFFFFFF' nothing comes back.
Certainly NOT intuitive!
Grateful for any pointers to params needed as such info seems very elusive.
What I WANT to do is cause the current IE to do a SAVE AS of its current URL
to a file name that I pass in.
I can get it to load a URL, but want it then to save it (in its correct format eg xls, pdf)
2006-02-25, 11:30:52
[hidden] from United States  
Hi John,
my pleasure to be able to help out. I wrote this code very long ago, in 2000 or 2001 and back then is when I posted it. I certainly found it in someone else's source code. DDE was not popular back then already anymore - everyone using OLE. It must be even harder to find documentation now in 2006. I cannot believe it's been 5 years, but DDE still works in XP I suppose. I do not have source code available to do a 'save as'. There is not even a guarantee that it can be done using DDE - you might just have to use OLE, if that is an option at all. I liked about DDE that you can hook into an existing application - less intrusive.

Peter (Author of this article)
2006-02-27, 10:55:53
anonymous from United Kingdom  
Very good of you to respond so quickly to my query and OF COURSE I now realise how right you are! DDE is for data exchange not controlling. You mention 5 years ago as a 'very long time ago', I was coming from the early 90s when I was using DDE (it was NEW) to control apps and how exciting it all was. But that was by calling a macro within the app (WORDPERFECT, WORD, EXCEL etc). I am now retired and not so nimble! Anyhow, I have been delving back into OLE and marvelling at TWebBrowser to get control and believe it or not, the bottom line seems to be that one cannot tell IE via OLE or TWebBrowser to Save a file with a given name. You can make it call the SAVE AS dialog with IEApp.ExecWB(OLECMDID_SAVEAS,OLECMDEXECOPT_DODEFAULT) but trying to pass additional parameters to give it the filename to use, is just not supported. So, after much more code bashing (and some learning) I am back where I was. I can get the URL but cannot save it other than by pressing keys.
If I get to do better than this I will come back and share the information with you.
Thanks again
2007-04-30, 08:42:12 from Pakistan  
Please let me know how to get path of folder in 'save as dialog box' . while user selects any folder for saving whole html page with all image and scripts files
I just required its returned path

thanks in advance

Please email me if possible



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: