马龙对战日本里约视频:How To Cause Navigation to Occur in Same WebB...
来源:百度文库 编辑:九乡新闻网 时间:2024/04/29 05:47:30
How To Cause Navigation to Occur in Same WebBrowser Window
When hosting the Internet Explorer 4.x or later WebBrowser control in a Visual B...
When hosting the Internet Explorer 4.x or later WebBrowser control in a Visual Basic application, you may want to have the navigation always occur in your application and not other Internet Explorer windows. If you handle the NewWindow2 event and set the Cancel flag equal to True, navigation is canceled completely. Since NewWindow2 does not provide you with the URL to navigate to as the Internet Explorer 3.x NewWindow event did, there doesn't appear to be any way to have the navigation occur in the same window.Fortunately, Internet Explorer 4.x or later provide the WebBrowser_V1 object for compatibility with Internet Explorer 3.x. Using the WebBrowser_V1 object, you can have your application receive events from version 3.x, 4.x, and 5.x. That means that you can handle the version 3.x NewWindow event and then have the navigation occur in the current window.
In order to implement this functionality in your Visual Basic application, follo...
In order to implement this functionality in your Visual Basic application, follow these step:- Create a form with a WebBrowser control on it.
- In the declarations section of that form, add the following:
Dim WithEvents Web_V1 as SHDocVwCtl.WebBrowser_V1
- In the Form_Load event, add the following:
Set Web_V1 = WebBrowser1.Object WebBrowser1.Navigate2 "http://www.microsoft.com/"
- After the NewWindow2 event fires, the Web_V1_NewWindow event will fire with the linked URL as one of its input arguments. Remember not to set Cancel to True in NewWindow2. Also, set the Processed variable to True in the NewWindow event handler so that a new instance of Internet Explorer will not be created. The following code shows this event handler and the code necessary to navigate within the current window:
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
- Right-click a link and select "Open in New Window" and you will find the link will still open inside your WebBrowser Control.
Please note that Internet Explorer does not fire a NewWindow or NewWindow2 event when the user presses CTRL+N or points to New under the File menu and clicks Window.
How To Cause Navigation to Occur in Same WebB...
How to be Happy in Hong Kong
HOW TO : use DDMS in Ubuntu
How to create a file in MS
How to display variables in Taglist window in...
How to Insert YouTube Videos in PowerPoint Presentations
How To Build an Add-in (XLL) for Excel Using ...
How to close Pandora's Box in Libya?
How to sort American interests in the South C...
Response in the marketing process to your customers how
How to read menus in China(Series 5) – Master...
How to setup OpenNI and Kinect in Windows XP?
How to Get PageRank 7 in 200 Days
How to 网站
How to打五笔
How to Study:
how to learn spanish
How to Propagate Peonies
How to exit Afghanistan
How to grow happness!
How to identify professional
HOW TO WRITE
How to Disable SELinux
China to allocate 18 bln to deepen navigation...