-
Apr 18th, 2014, 02:47 PM
#1
Thread Starter
Addicted Member
[RESOLVED] [VB 2010] How to get Internet ExplorerTitle When Visiting a Webpage?
Edit: UPS, I've just noticed that I posted in a wrong section... I have requested the topic Moved..
I have tried using Classnames and Window Handle to get the Titles of Internet Explorere when visiting Webpages, but its simply not allowing me to do so. I have tried using Classname and Win Handle of IE to get the Titles, but I cant make it work.
I have so far managed to make it work on Chrome and Firefox. But still strugling with IE. My goal is to create a software that Automatically gets the Titles of Active Webrowsers. I have also used the "Microsoft Internet Controls" for the first time to see if I could get the Titles of IE. But I guess thats only allowing me to get a certain info like the Handle and URLs, but not the Title.
Hope that someone could give me some more advice, or add an example code to get the Webpage Titles of IE.
Thanks a lot in advance...
Last edited by Miklogak; Apr 18th, 2014 at 05:00 PM.
Reason: Wrong Scction... Have requested the Topic Moved to Visual Basic.NET Forums.
A huge thanks to all the Great Developers and Helpers on vBForums for helping me and many others! Special thanks to Dunfiddlin, Paul, TechnoGome, , JayInThe813, ident for helping me with my projects througout the years. Incl. those i forgot to mention!
-
Apr 19th, 2014, 08:37 AM
#2
Re: [VB 2010] How to get Internet ExplorerTitle When Visiting a Webpage?
Thread moved from the 'CodeBank VB.Net' forum (which is for you to post working code examples, not questions) to the 'VB.Net' forum... thanks for letting us know
-
Apr 19th, 2014, 09:28 AM
#3
Re: [VB 2010] How to get Internet ExplorerTitle When Visiting a Webpage?
ok here's an example...
you need a reference to Microsoft.mshtml (.NET) and a reference to Microsoft Internet Controls (COM):
Code:
Imports mshtml
Imports SHDocVw
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim shellWindows As SHDocVw.ShellWindows = New SHDocVw.ShellWindows()
For Each ie As SHDocVw.InternetExplorer In shellWindows
Dim filename As String = System.IO.Path.GetFileNameWithoutExtension(ie.FullName).ToLower()
If filename = "iexplore" Then
MsgBox(ie.LocationName)
End If
Next
End Sub
End Class
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Apr 19th, 2014, 04:44 PM
#4
Fanatic Member
Re: [VB 2010] How to get Internet ExplorerTitle When Visiting a Webpage?
OR one could look through the process list
Code:
For Each f As Process In Process.GetProcesses
If f.MainWindowTitle <> "" Then
If f.MainWindowTitle.ToString.Contains("Google Chrome") Or f.MainWindowTitle.ToString.Contains("Internet Explorer") Then
ListBox1.Items.Add(f.MainWindowTitle)
End If
End If
Next
This gets me the below
My CodeBank Submissions
- Listbox with transparency and picture support - Click Here
- Check for a true internet connection - Click Here
- Open Cash drawer connected to receipt printer - Click Here
- Custom color and size border around form - Click Here
- Upload file to website without user logins, includes PHP - Click Here
- List All Removable USB Storage Devices - Click Here
- Custom On/Off Slide Control - Click Here
- Insert multiple rows of data into one database table using parameters - Click Here
- Trigger USB/Serial Cash Drawer - Click Here
-
Apr 19th, 2014, 05:43 PM
#5
Thread Starter
Addicted Member
Re: [VB 2010] How to get Internet ExplorerTitle When Visiting a Webpage?
@si_the_geek + Rep and thank you very much for the quick response and for accepting my request for moving the thread. You guys are doing an incredible job taking care of a large forum as vBForums...
@Paul, Thank you so much, Very easy than the code I am using! I tried to add + Rep, But sadly its telling me to spread a few Arround first. About the Code.... I made it work using the exact same method that I had failed with earlier. I had actually missed the option called "LocationName" but had used the other options.. Anyways your Peace of code is less smaller than the one I was using. So again thank you for that...
@bensonsearch, +Rep ... Awesome method! I am also using a method that seeks for PRocess first. But Sadly my code is 20 times longer.. lol I am grabbing the Handle for each Window + Win Class.. I think I am going for the method you are using for my other Browser Titles! Cheers. And thanks a lot.
Wish you guys a great Easter BTW,,
This Thread has been marked Resolved!
Last edited by Miklogak; Apr 19th, 2014 at 05:51 PM.
A huge thanks to all the Great Developers and Helpers on vBForums for helping me and many others! Special thanks to Dunfiddlin, Paul, TechnoGome, , JayInThe813, ident for helping me with my projects througout the years. Incl. those i forgot to mention!
-
Apr 19th, 2014, 05:47 PM
#6
Re: [VB 2010] How to get Internet ExplorerTitle When Visiting a Webpage?
My method can be modified to work with all browsers too.
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Apr 19th, 2014, 06:17 PM
#7
Thread Starter
Addicted Member
Re: [VB 2010] How to get Internet ExplorerTitle When Visiting a Webpage?
@Paul, Sorry yeh I just noticed that you have also added the "Microsoft.mshtml" . While I only had the "Microsoft Internet Controls" and were able to get the Titles of I.E Can you tell me short what is the "mshtml" for and if it is neccesary and if you could add an example of how I can make it work with other Browsers?
Thank you very much in advance!
Last edited by Miklogak; Apr 19th, 2014 at 06:29 PM.
A huge thanks to all the Great Developers and Helpers on vBForums for helping me and many others! Special thanks to Dunfiddlin, Paul, TechnoGome, , JayInThe813, ident for helping me with my projects througout the years. Incl. those i forgot to mention!
-
Apr 19th, 2014, 06:28 PM
#8
Re: [RESOLVED] [VB 2010] How to get Internet ExplorerTitle When Visiting a Webpage?
I think I accidentally left that in the example code. I adapted it from another snippet that was originally written for a different purpose, which I've modified for other uses over time. So I don't think it is necessary in that code, but I'm not at my PC at the moment, so I can't test that.
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Apr 19th, 2014, 06:38 PM
#9
Thread Starter
Addicted Member
Re: [VB 2010] How to get Internet ExplorerTitle When Visiting a Webpage?
@Paul, Thanks Paul for the quick reply! ou really dont have to, I have many ways I can choose from! I was just wondering how to because I had used many hours but failed. BTW, I will remove the mshtml part thx for letting me know..!
A huge thanks to all the Great Developers and Helpers on vBForums for helping me and many others! Special thanks to Dunfiddlin, Paul, TechnoGome, , JayInThe813, ident for helping me with my projects througout the years. Incl. those i forgot to mention!
-
Apr 19th, 2014, 07:10 PM
#10
Re: [RESOLVED] [VB 2010] How to get Internet ExplorerTitle When Visiting a Webpage?
just change this:
Code:
Dim filename As String = System.IO.Path.GetFileNameWithoutExtension(ie.FullName).ToLower()
If filename = "iexplore" Then
MsgBox(ie.LocationName)
End If
to this:
Code:
MsgBox(ie.LocationName)
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Apr 20th, 2014, 12:13 PM
#11
Re: [RESOLVED] [VB 2010] How to get Internet ExplorerTitle When Visiting a Webpage?
vb Code:
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim procs = Process.GetProcesses.Where(Function(p) p.ProcessName = "iexplore" OrElse p.ProcessName = "chrome") Me.ListBox1.Items.AddRange(Array.ConvertAll(procs.ToArray, Function(p) p.MainWindowTitle)) End Sub End Class
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|