Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. get URL !!!!

get URL !!!!

Scheduled Pinned Locked Moved C#
csharphelpquestion
5 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    students552 university
    wrote on last edited by
    #1

    Hi all how can I write programe in C# to get thw URL from the address bar when any one use the internet explorer . Please help me. Thanks.

    A H 2 Replies Last reply
    0
    • S students552 university

      Hi all how can I write programe in C# to get thw URL from the address bar when any one use the internet explorer . Please help me. Thanks.

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      You might want to explain why you want this first...people on here aren't too interested in helping with spyware applications...just in case that's what you had in mind.

      1 Reply Last reply
      0
      • S students552 university

        Hi all how can I write programe in C# to get thw URL from the address bar when any one use the internet explorer . Please help me. Thanks.

        H Offline
        H Offline
        Heath Stewart
        wrote on last edited by
        #3

        If you're hosting the WebBrowser control in your Windows Forms application, get the LocationURL property. If you want to get the URL from a running instance of Internet Explorer, you can use the InternetExplorerClass from shdocvw.dll by creating an RCW (Runtime Callable Wrapper, or "interop assembly") like so:

        tlbimp /out:Interop.SHDocVw.dll %windir%\system32\shdocvw.dll

        You can also create this in VS.NET by adding a reference to your project, click on the COM tab, and find "Microsoft Internet Controls". You can then do something like this:

        InternetExplorerClass ie = new InternetExplorerClass();
        return ie.LocationURL;

        There are rules regarding this property and what can retrieve the value, so you should read about it in the MSDN Library[^]. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]

        S 1 Reply Last reply
        0
        • H Heath Stewart

          If you're hosting the WebBrowser control in your Windows Forms application, get the LocationURL property. If you want to get the URL from a running instance of Internet Explorer, you can use the InternetExplorerClass from shdocvw.dll by creating an RCW (Runtime Callable Wrapper, or "interop assembly") like so:

          tlbimp /out:Interop.SHDocVw.dll %windir%\system32\shdocvw.dll

          You can also create this in VS.NET by adding a reference to your project, click on the COM tab, and find "Microsoft Internet Controls". You can then do something like this:

          InternetExplorerClass ie = new InternetExplorerClass();
          return ie.LocationURL;

          There are rules regarding this property and what can retrieve the value, so you should read about it in the MSDN Library[^]. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]

          S Offline
          S Offline
          students552 university
          wrote on last edited by
          #4

          I write in my programe : InternetExplorerClass ie = new InternetExplorerClass(); textBox1.Text = ie.LocationURL; but when i excute it , it gives empty string not url ,what is the wrong???

          H 1 Reply Last reply
          0
          • S students552 university

            I write in my programe : InternetExplorerClass ie = new InternetExplorerClass(); textBox1.Text = ie.LocationURL; but when i excute it , it gives empty string not url ,what is the wrong???

            H Offline
            H Offline
            Heath Stewart
            wrote on last edited by
            #5

            I told you - you need to read the documentation for the property: it is protected for the very same reasons that the other reply mentioned - to prevent malware from gather information about your browsing habits out of process. There is more information about what is and isn't possible at http://msdn.microsoft.com/library[^]. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups