Pull the current URL address from Internet Explorer

  • Thread starter Thread starter garyusenet
  • Start date Start date
G

garyusenet

Hi,

I am writing a utility to help me in Internet Explorer.

How do i access Internet Explorer information.

For starters I would like to read the current URL from internet
explorer, into a variable in my programme. How do i do this?

Thankyou

Gary
 
I'm getting somewhere with this.
I have learnt that I need to include Shdocvw.dll into my project. And
then use the following code...

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;


namespace InternetExplorerInterface
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
foreach (InternetExplorer ie in new ShellWindows())
{
MessageBox.Show(ie.HWND);
MessageBox.Show(ie.LocationName);
MessageBox.Show(ie.LocationURL);

}

}
}
}
However when i run this my code can't find ShellWindows() - i'm guess
this is because i haven't included it's namespace in my using
directives.. But i'm having trouble finding out which namespace it
belongs to.

Also I do not really understand what a dll is (my limited understanding
before was that it was a driver file for a device) but that isn't
sufficing now as i'm getting into programming.

Can someone clarify this for me please? And also suggest why my code
isn't compiling.

TIA
 
This is a slow day for the group today! Not many replies. I guess the
learned programmers must be involved in their own projects!

Not to worry about this thread anymore, after much investigation i've
solved it!
 
here is an example, you will need to add references to Microsoft.mshtml (ActiveX) and SHdocVw

SHDocVw.ShellWindows SWs = new SHDocVw.ShellWindows();

object Doc;

foreach (SHDocVw.InternetExplorer IE in SWs)

{

Doc = IE.Document;

if (Doc.GetType().FullName == "mshtml.HTMLDocumentClass")

{

mshtml.HTMLDocumentClass oHTML = (mshtml.HTMLDocumentClass)Doc;

if (oHTML.title != "")

{

}

}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top