Home > Software engineering >  Why each time with WebBrowser_NewWindow2 newly opened web page is a small window. How can change the
Why each time with WebBrowser_NewWindow2 newly opened web page is a small window. How can change the

Time:09-22

 Private Sub Form_Load () 
Form_Resize
The WebBrowser. Navigate (" www.baidu.com ")
The WebBrowser. Silent=True
End Sub

Private Sub Form_Resize ()
On the Error Resume Next
WebBrowser. Move 20, 20, the Me ScaleWidth, Me. ScaleHeight
End Sub

Private Sub WebBrowser_NewWindow2 (ppDisp As Object, Cancel the As Boolean)
Dim FRM As frmWebBrowser
The Set FRM=New frmWebBrowser
FRM. Visible=True
The Set ppDisp=FRM. WebBrowser. Object
End Sub

CodePudding user response:

I think because of your 'window template is a small window!

Before you can be in FRM. Visible=True, and set the size of FRM statements,

CodePudding user response:

Original "NewWindow2 excitation before creating a new window", so the "DocumentComplete when the document is complete, refresh the page does not inspire" after the adjustment window, with the following sentence is ok,

Private Sub WebBrowser_DocumentComplete (ByVal pDisp As Object, the url As the Variant)
WebBrowser. Move 20, 20, the Me ScaleWidth, Me. ScaleHeight
End Sub

Below is a WebBrowser events:
BeforeNavigate2 navigation before excitation, refresh without
CommandStateChange when activated state change command, it shows that when activated or shut down the Back and Forward
A menu item or button
DocumentComplete when complete is to inspire the entire document, refresh the page does not inspire
DownloadBegin when a download operation has started after excitation, refresh also can stimulate the event
DownloadComplete when a download operation has been completed after excitation, refresh also can stimulate the event
NavigateComplete2 navigation after the completion of the excitation, refresh without
NewWindow2 inspire before creating a new window
OnFullScreen excitation when the FullScreen property changes, the event using VARIENT_BOOL a lose
Into the parameter to indicate that the IE is full screen mode (VARIENT_TRUE) or ordinary display mode (VARIENT_FALSE)
OnMenuBar change MenuBar attribute, labeling is VARIENT_BOOL type parameters,
VARIANT_TRUE is visible, VARIANT_ FALSE hidden
OnQuit call Quit method whether the user closes the browser or the developer can activate when IE exit
OnStatusBar and OnMenuBar calls in the same way, marking the status bar is visible,
OnToolBar calls the method is alexandrine, marking the toolbar is visible,
OnVisible control window is visible or hidden, and use a VARIENT_BOOL parameter of type
StatusTextChange if you want to change the text in the status bar, this event will be inspired, but it does not ignore the program if there is a status bar
TitleChange Title or change when effectively

CodePudding user response:

reference 1st floor Chen8013 response:
I think because of your 'window template is a small window!

Before you can be in FRM. Visible=True, plus the set statement, the size of FRM


Doesn't work, try where all useless,

CodePudding user response:

The attribute of modified iexplore. Exe?

CodePudding user response:

Yao can ah, you copy the code below test:
 Private Sub Form_Load () 
Form_Resize
The WebBrowser. Navigate (" www.baidu.com ")
The WebBrowser. Silent=True
End Sub

Private Sub Form_Resize ()
On the Error Resume Next
WebBrowser. Move 20, 20, the Me ScaleWidth, Me. ScaleHeight
End Sub

Private Sub WebBrowser_NewWindow2 (ppDisp As Object, Cancel the As Boolean)
Dim FRM As frmWebBrowser
The Set FRM=New frmWebBrowser
FRM. Move 0, 5000, 8000, 8000
FRM. Visible=True
The Set ppDisp=FRM. WebBrowser. Object
End Sub

CodePudding user response:

reference 5 floor sysdzw reply:
can obviously, you copy the code below test:
 Private Sub Form_Load () 
Form_Resize
The WebBrowser. Navigate (" www.baidu.com ")
The WebBrowser. Silent=True
End Sub

Private Sub Form_Resize ()
On the Error Resume Next
WebBrowser. Move 20, 20, the Me ScaleWidth, Me. ScaleHeight
End Sub

Private Sub WebBrowser_NewWindow2 (ppDisp As Object, Cancel the As Boolean)
Dim FRM As frmWebBrowser
The Set FRM=New frmWebBrowser
FRM. Move 0, 5000, 8000, 8000
FRM. Visible=True
The Set ppDisp=FRM. WebBrowser. Object
End Sub

I said in the 1st floor of the method, is certainly can,
He must say "no effect", I can only say "ha ha... ".
It is very simple, the original poster was gone, also ask why it,
  • Related