lundi 11 mai 2015

how to process.MainWindowTitle.Contains(str1,str2,str3.....)

I am trying to find more than one MainWindowTitle to a process

for example I have a string in My.resource like this: google:yahoo:msn:ebay....etc and I

have this code to look if one of the strings in my resource string exists to

show a message box

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    Dim LOKUP As New Process
    For Each LOKUP In Process.GetProcesses
        If LOKUP.MainWindowTitle.Contains(Split(My.Resources.String2, ":").ToString) Then
            MsgBox("Allowed - Site - Web")
        Else
            MsgBox("This Site Is Forbidden Sorry")
            'close site
        End If
    Next
End Sub

the problem this code didn't work because the function Contains have only one string.

thank you for your help in advance

Aucun commentaire:

Enregistrer un commentaire