delete
-
delete
-
delete
I don't understand your question. Do you want your program to navigate the browser to a specific url? /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
delete
-
I don't understand your question. Do you want your program to navigate the browser to a specific url? /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
No, i want to see in a textbox from my program which url is opened in Firefox or IE. I don´t want to open a Website this works with webbrowser1.Navigate("Url"); Example: I open firefox and i go to codeproject.com . Now i want to see this Url(codeprojekt.com) in my program http://cboard.cprogramming.com/cplusplus-programming/118525-how-get-url-out-firefox.html but that is in C++
-
Yes, that works with the webBrowser from C# but how does it work with Firefox or IE?
-
delete
Hi, you could read the content of the address bar of some browsers. In C# that would take some P/Invoke code to call FindWindow and GetWindowText; as the window belongs to another process, you would also need to allocate and access memory in that other process. You can find some of the basic techniques in my TrayIconBuster article (LP_Process class). Doing it this way would have several limitations: 1. the solution is slightly different for each specific web browser, as the logical location of the address bar will vary. 2. the address bar does not always represent the current page; e.g. when frames are involved, the bar will show the URL of the frames page, not the contained page(s). The alternative is to create your own browser and have the required functionality built-in. A good starting point would be the WebBrowser Control. Of course, people could still use another browser, but so they can in the former approach (you can't prevent them from downloading and installing FireFox, Safari, Chrome, etc). :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
delete
Isn't this sort of info somewhere in the browser log, history or something, maybe you can use that instead of scraping the browser window.
Never underestimate the power of human stupidity RAH
-
No, i want to see in a textbox from my program which url is opened in Firefox or IE. I don´t want to open a Website this works with webbrowser1.Navigate("Url"); Example: I open firefox and i go to codeproject.com . Now i want to see this Url(codeprojekt.com) in my program http://cboard.cprogramming.com/cplusplus-programming/118525-how-get-url-out-firefox.html but that is in C++
You could browse IE's url history or write a browser helper object that could send the url to your Windows Forms app. See these articles for ideas:
- WebCacheTool: Manipulate the IE Browser Cache From the Command-Line[^]
- How to attach to Browser Helper Object (BHO) with C# in two minutes[^]
/ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
Isn't this sort of info somewhere in the browser log, history or something, maybe you can use that instead of scraping the browser window.
Never underestimate the power of human stupidity RAH
Thanks for help this with P/Invoke is a good idea. Now i found this using NDde.Client; class Test { public static string GetFirefoxURL() { DdeClient dde = new DdeClient("Firefox", "WWW_GetWindowInfo"); dde.Connect(); string url = dde.Request("URL", int.MaxValue); dde.Disconnect(); return url; } } i must online add the dll NDde then it works great. http://ndde.codeplex.com/ But it only works with Firefox has sombody an idea how it can work with IE or Opera?
-
Thanks for help this with P/Invoke is a good idea. Now i found this using NDde.Client; class Test { public static string GetFirefoxURL() { DdeClient dde = new DdeClient("Firefox", "WWW_GetWindowInfo"); dde.Connect(); string url = dde.Request("URL", int.MaxValue); dde.Disconnect(); return url; } } i must online add the dll NDde then it works great. http://ndde.codeplex.com/ But it only works with Firefox has sombody an idea how it can work with IE or Opera?
I've the same problem. I was searching a long time and the best solution I was found is DllImport(user32.dll) You should use some methods like FindWindow, FindWindowEx and SendMessage. You must first find main class of IE window, e.g. use WinSpy++. Then you go from class to class, from parent to child (IEFrame -> WorkerW -> ReBarWindow32 -> Address Band Root -> edit) First use FindWindow, next FindWindowEx. In class named "edit" there is a url. Use SendMessage, WM_GETTEXT and e.g. StringBuilder class to get the url. But it only works with IE :) How do this in Opera or Chrome? Any idea?