Microsoft KB Archive/184600

= FIX: WebBrowser Events Not Being Received Inside Java =

Article ID: 184600

Article Last Modified on 11/14/2005

-

APPLIES TO


 * Microsoft Software Development Kit for Java 2.02
 * Microsoft Software Development Kit for Java 2.02
 * Microsoft Software Development Kit for Java 2.01

-



This article was previously published under Q184600



SYMPTOMS
Attempting to call the following methods after hosting a WebBrowser control inside a Java application or applet fails: public void BeforeNavigate2(Object pDisp, Variant URL, Variant Flags,                           ...); public void NewWindow2(Object[] ppDisp, boolean[] Cancel);



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in the Microsoft virtual machine contained in the SDK for Java 3.0, Microsoft VM build 2829.



Steps to Reproduce Behavior
 Install Internet Explorer 4.0x. Download SDK for Java version 2.0x from http://www.microsoft.com/mscorp/java/ Load the sample JBrowser from the SDK-Java.20x/Samples directory.  Modify JBrowser.Java to implement the following two methods: public void BeforeNavigate2(Object pDisp, Variant URL, Variant Flags,                          Variant TargetFrameName, Variant PostData,                           Variant Headers, boolean[] Cancel) {    System.out.println("BeforeNavigate2"); }

public void NewWindow2(Object[] ppDisp, boolean[] Cancel) {  System.out.println("NewWindow2"); }                        Build the JBrowser project using the JVC that ships with the SDK for Java. You will notice the output in the DOS window from which the JBrowser application is launched. Watch for specified events above:

<ul> Try navigating using the Open option on the File menu.</li> Try navigating to any site, then right-click, and click Open in the new window.</li></ul> </li> The above mentioned events are not received.</li></ol>

<div class="references_section">