We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Obtaining current URL from browser

royster
royster asked
on
Medium Priority
245 Views
Last Modified: 2010-04-30
I'd like to be able to obtain the URL for a page being displayed in a browser. If you can post an api call (from shell32.dll?) to fetch the URL please show me. -Roy
Comment
Watch Question

Commented:
You could use DDE...  There's DDE info for Netscape.
The following is the Command you would use with Netscape.
----
WWW_GetWindowInfo

     Netscape is: Server.
     Transaction Type: XTYP_REQUEST.
     Item (Arguments): dwWindowID
          dwWindowID is the Netscape window to obtain current information on. This value can be 0xFFFFFFFF to specify the last active Netscape window.
     Data (Returns): qcsURL,qcsTitle
          qcsURL is the current URL loaded in the window.
          qcsTitle is the current title of the Netscape window.
     Description: This topic will fail if Netscape can not provide both return values (a blank page is loaded, so there is no URL), or if an invalid dwWindowID is
     specified.
---

You can find the Netscape DDE API info at http://home.netscape.com/newsref/std/ddeapi.html

And, you can find some sample code at http://home.computer.net/~mheller/dde.html.

Hope this helps.

Author

Commented:
Thanks for your effort, tnatsni. I'm hoping there's a way to do it via an api call so I don't have to add code and hunt down info for each possible browser. - Roy
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
That works great =). Thanks a lot. I made a small modification to the code:
' See if the title ends with " - Netscape". (((replaced with:)))
' See if the title has a browser name in it
If InStr(title, "Internet Explorer") Or InStr(title, "Netscape") Then
' This is it. Find the ComboBox information.
Form1.lblAddress = EditInfo(app_hwnd)

Thanks again, Roy
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.