How can I solve the problem of opening a new window for IE by using the VB6.0 webbrowser control?

Source: Internet
Author: User

How can I solve the problem of opening a new window for IE by using the VB6.0 webbrowser control?

Http://tieba.baidu.com/F? Kz= 177310026

VB Baidu post it http://tieba.baidu.com/F? KW = VB & Fr = ala0

Method 1:
Private sub commandementclick ()
Webbrowser1.navigate text1.text 'click command1 to open the URL of text1
End sub

Private sub form_resize ()
If me. windowstate <> 1 then webbrowser1.width = me. scalewidth: webbrowser1.height = me. scaleheight-webbrowser1.top 'adjust webbrowser1 to the window size
End sub

Private sub webbrowser1_newwindow2 (ppdisp as object, cancel as Boolean)
If option1.value = true then' if a single segment option1 (open in the current window)
Set ppdisp = webbrowser2.application
Webbrowser2.zorder
'Open webbrowser2. Jump to webbrowser2_beforenavigate2.
Else' if you select to open in a new window
Dim newform as new form1
Newform. Show 'a new form1 window is displayed.
Set ppdisp = newform. webbrowser1.application
Newform. webbrowser1.zorder
'Open in the new form1 window.
End if
End sub

Private sub webbrowser2_beforenavigate2 (byval Pdisp as object, URL as variant, flags as variant, targetframename as variant, postdata as variant, headers as variant, cancel as Boolean)
Webbrowser2.stop 'webbrowser2 stopped
Webbrowser1.stop 'webbrowser1 stopped
Webbrowser1.navigate URL 'webbrowser1 open URL
End sub

Method 2:
Private sub webbrowser1_newwindow2 (ppdisp as object, cancel as Boolean)
Cancel = true
Webbrowser1.navigate2 webbrowser1.document. activeelement. href
End sub

Method 3:
Dim withevents web_v1 as shdocvwctl. webbrowser_v1
Private sub form_load ()
Set web_v1 = webbrowser1.object
Webbrowser1.navigate2"Www.sina.com"
End sub

Private sub web_v1_newwindow (byval URL as string ,_
Byval flags as long ,_
Byval targetframename as string ,_
Postdata as variant ,_
Byval headers as string ,_
Processed as Boolean)
Processed = true
Webbrowser1.navigate URL
End sub

Note that dim withevents web_v1 as shdocvwctl. webbrowser_v1
Put in commonCodeLi

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.