Ok here's the situation. Want to control if certain websites are accessed. I can put in a name such as "yahoo" or "vbcity" or whatever in the code and it works. But I want to be able to add name to the list without rewriting the program everytime I want to add a site. Is this possible with a simple text file?
The code below seems to retrieve the info that I need, but it puts 2 little squares between each name in the text file, I think then it looks for the site name with those 2 little suares added. If I just type one name in the text file it works, but when I type more than one, it doesn't. Thanks in advance.
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click For Each proc As Process In Process.GetProcessesByName("iexplore") 'calls internet explorer process Dim intex As String = proc.MainWindowTitle.ToLower 'changes MainWindowTitle text to lower case Dim fileContents As String fileContents = My.Computer.FileSystem.ReadAllText("C:\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\textfile1.txt") 'reads text file If intex.Contains(fileContents) Then MsgBox("Found Window!") Else : MsgBox("Could not find window") End If Next End Sub
Thank You,
Michael Ifland
Visual Basic.NET 2005




Reply With Quote