vb.net - how to process.MainWindowTitle.Contains(str1,str2,str3.....) -
i trying find more 1 mainwindowtitle process
for example:- have string in my.resource this: google:yahoo:msn:ebay....etc , have code if 1 of strings in resource string exists show message box
private sub timer1_tick(byval sender system.object, byval e system.eventargs) handles timer1.tick dim lokup new process each lokup in process.getprocesses if lokup.mainwindowtitle.contains(split(my.resources.string2, ":").tostring) msgbox("allowed - site - web") else msgbox("this site forbidden sorry") 'close site end if next end sub
the problem code didn't work because function contains have 1 string.
you can use nest additional each , use boolean display message box.
private sub timer1_tick(byval sender system.object, byval e system.eventargs) handles timer1.tick dim lokup new process dim siteflag boolean = false each lokup in process.getprocesses each site string in my.resources.string2.split(":") if lokup.mainwindowtitle.contains(site) siteflag = true end if next next if siteflag msgbox("allowed - site - web") else msgbox("this site forbidden sorry") 'close site end if end sub
Comments
Post a Comment