Monday, February 18, 2008 5:33 PM
The question is in the subject...
How can I extract the active URL currently displayed on the browser using C# code? (note that for IE7, I need the 'selected-tab' URL).
Thursday, February 21, 2008 1:21 PM
Thursday, February 21, 2008 1:45 PM
you can have more then one explorer instance running so it is not crear witch text you need to extract.
any way if you actuay know the exact instance you can:
find it's control holding the text and call a getWindowtext on it.
Thursday, February 21, 2008 3:27 PMAssuming I have only one IE opened, could you post an example about how to do it?
Thursday, February 21, 2008 4:10 PM
I can not post an example but i will try to give some pseudo code. basicly this code uses native code so you will need to DllImport it into a C# code.
1. call FindWindowEX function o find the IE main window
2. after you find it call the same function to get to the Edit control that holds the relevant text. with Spy you can get the ID of the window
3. now it is easy to call GetWindowText to get the text in the editBox.