-
2 Questions?
I have 2 questions. 1. i am using axwebbrowser control to display web pages, how can i capture a pop up window and make it one of my mdi childern(this is in a mdiparent form) i need to know how i can capture it and i need it to be related in somehow to the form it poped up from so that if i am logged into somewere when the pop up comes that it does not have to go through the login process(i have been having to do that alot) and 2.how can i make a child form not be able to close until the mdiparent form is closing
THANKS ahead of time for any answers!
-
-
Well, I'll try to answer the first part of your first question (I'm not sure about how to automatically log in since I don't know how you log in to begin with). To capture a popup window go to the NewWindow2 event and set the property of ppDisp to that of a new unnavigated browser window. So for example the code would look like this...
Private Sub WebBrowser1_NewWindow2(ppDisp As Object,
Cancel As Boolean)
Dim frmWB As Form1
Set frmWB = New Form1
frmWB.WebBrowser1.RegisterAsBrowser = TRUE
Set ppDisp = frmWB.WebBrowser1.Object
frmWB.Visible = True
End Sub
And for your second question, the easiest way to stop a user shutting a window is to remove the close box. To do this just set the ControlBox property to false on the child window.
-
Something wrong
Set ppDisp = frmWB.WebBrowser1.Object it will not let me put the object after webbrowser it draws the blue line under it if it makes a difference my web browser is axwebbrowser1. everything else is perfect but it will not let me put the .object after the axwebbrowser1
-
Sorry, that was vb6 code, I'll check into how to do it under .net.
-
Okay, easy fix, just replace .object with .application. So that code written in .net would be.
Private Sub AxWebBrowser1_NewWindow2(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_NewWindow2Event) Handles AxWebBrowser1.NewWindow2
Dim frmWB As New Form2()
frmWB.AxWebBrowser1.RegisterAsBrowser = True
e.ppDisp = frmWB.AxWebBrowser1.Application
frmWB.Show()
End Sub
-
WORKS GREAT!! THANKS A LOT!!