close pop-up window using shdocvw?
开发者_如何学运维I used to close pop-up windows in VBA using the following code:
Dim k As New shdocvw.ShellWindows ' close menu window
Dim c As WebBrowser
For Each c In k
If c.LocationURL = "http://specificsite.com/x.html" Then c.Quit()
Next
You can see I have to check if the pop-up was opened and then close it.
I've migrated to VB.NET e2010 and it doesn't work.
I've found how to handle events and use the NewWindow
to cancel the opening of the pop-up.
Unfortunately by cancelling instead of closing after it was opened, it causes a script error by JavaScript on the main page.
How can this be solved?
I was working on similar kind of project that i used shdocvw you can find it here
You could also find this one helpful this is using c# but you can convert it into VB Click Here
精彩评论