webbrowser/axwebbrowser newwindow3 popup help

anteck7

New member
Joined
Aug 7, 2012
Messages
2
Programming Experience
Beginner
Hello,

I'm building a forms application that loads our helpdesk software (Remedy) and watches for email addresses. It then turns the email address into an AD lookup and displays things like their username, account status, ect.

However, our remedy webapplication opens a few popups that need to keep the session state intact. I've done this using the newwindow3 event, however, when the popup closes, the original form fails to work correctly (buttons don't work, content isn't updated). If I don't catch the new window event, and allow it to open in ie (I have to log in), everything works like expected.

I've tried 2 different ways of handling it to no avail.

Method 1 in .net 4.0





[XCODE]
    Private Sub AxWebBrowser1_NewWindow3(sender As Object, e As AxSHDocVw.DWebBrowserEvents2_NewWindow3Event) Handles AxWebBrowser1.NewWindow3
        'Method 1
        processed()
        Dim Ax2 As New AxSHDocVw.AxWebBrowser
        Dim f As New Form
        f.Controls.Add(Ax2)
        f.Show()
        e.ppDisp = Ax2.Application
[/XCODE]

The app correctly captures the popup (all of them, but ill use a singular example of selecting your technician).

I select a technician in the displayed popup form, and hit "Save", this appear to be a javascript button which also closes the form.

After hitting the save button, focus is returned to the original Form. However, the assigned technican does not change, nor do any of the buttons on form work (except the ones that create popups).

I have the same problem with the following implimentation using the webbrowser control and the activeXinstance

[XCODE]
 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        WebBrowser1.Navigate("website")
        Dim activeXBrowser As SHDocVw.WebBrowser = CType(WebBrowser1.ActiveXInstance, SHDocVw.WebBrowser)
        AddHandler activeXBrowser.NewWindow3, AddressOf axBrowserNewWindow3


    End Sub


    Private Sub axBrowserNewWindow3(ByRef ppDisp As Object, ByRef cancel As Boolean, dwflags As UInteger, bstrUrlContent As String, bstrUrl As String)
        Dim frm As New Form2
        'MessageBox.Show(bstrUrl)
        frm.Show()
        ppDisp = CType(frm.WebBrowser1.ActiveXInstance, SHDocVw.WebBrowser).Application
        frm.Show()
        'cancel = True
    End Sub

[/XCODE]
 
Last edited:

anteck7

New member
Joined
Aug 7, 2012
Messages
2
Programming Experience
Beginner
The javascript that is being kicked off on the popup is this

<a href="javascript:" id="WIN_0_301912800" arid=301912800 artype="Control" ardbn="z3Btn Select" artcolor="null" class="btn btn3d arfid301912800 ardbnz3BtnSelect" style="top:295; left:23; width:35; height:21;z-index:999;"><div class="btntextdiv" style="top:0; left:0; width:35; height:21;"><div class="f1" style=";width:35">OK</div>
</div>
</a>
<a href="javascript:" id="WIN_0_301845500" arid=301845500 artype="Control" ardbn="z3Btn Cancel" artcolor="null" class="btn btn3d arfid301845500 ardbnz3BtnCancel" style="top:295; left:63; width:53; height:21;z-index:1000;"><div class="btntextdiv" style="top:0; left:0; width:53; height:21;"><div class="f1" style=";width:53">Cancel</div>
</div>
 
Top Bottom