Results 1 to 7 of 7

Thread: 2 Questions?

  1. #1

    Thread Starter
    Addicted Member Buy2easy.com's Avatar
    Join Date
    Jul 2002
    Posts
    200

    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!

  2. #2

    Thread Starter
    Addicted Member Buy2easy.com's Avatar
    Join Date
    Jul 2002
    Posts
    200
    bump

  3. #3
    Member
    Join Date
    Jul 2002
    Posts
    49
    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.

  4. #4

    Thread Starter
    Addicted Member Buy2easy.com's Avatar
    Join Date
    Jul 2002
    Posts
    200

    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

  5. #5
    Member
    Join Date
    Jul 2002
    Posts
    49
    Sorry, that was vb6 code, I'll check into how to do it under .net.

  6. #6
    Member
    Join Date
    Jul 2002
    Posts
    49
    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

  7. #7

    Thread Starter
    Addicted Member Buy2easy.com's Avatar
    Join Date
    Jul 2002
    Posts
    200
    WORKS GREAT!! THANKS A LOT!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width