Microsoft KB Archive/195160

= PRB: Wjview.exe Causes Unhandled Exception on Handle Creation =

Article ID: 195160

Article Last Modified on 6/14/2006

-

APPLIES TO


 * Microsoft Visual J++ 6.0 Standard Edition
 * Microsoft Software Development Kit for Java 3.1
 * Microsoft Software Development Kit for Java 3.2

-



This article was previously published under Q195160



SYMPTOMS
If a class that extends the Window class is created with className LISTBOX and overrides wndProc and handles the WM_CREATE message, then Wjview.exe causes an unhanded exception on handle creation.



RESOLUTION
The Window with className LISTBOX must pass the WM_CREATE message on to defWndProc in order for the class to be created correctly.



Steps to Reproduce Behavior
  Create a Java source WndTest.java: import com.ms.wfc.app.*; import com.ms.win32.*;

public class WndTest extends Window { protected void wndProc(Message m)   { switch (m.msg) {       case winw.WM_CREATE: break; default : defWndProc(m); break; }  } }                          Create a Java source Form1.java: import com.ms.wfc.app.*; import com.ms.wfc.core.*; import com.ms.wfc.ui.*; import com.ms.wfc.html.*; import com.ms.win32.*;

/** public class Form1 extends Form {  public Form1 {     // Required for Visual J++ Form Designer support initForm;
 * This class can take a variable number of parameters on the command
 * line. Program execution begins with the main method. The class
 * constructor is not invoked unless an object of type 'Form1' is
 * created in the main method.

// TODO: Add any constructor code after initForm call }

/**  public void dispose {     super.dispose; components.dispose; }   private void button1_click(Object source, Event e)   { CreateParams cp = new CreateParams; cp.className = "LISTBOX"; cp.style = winw.WS_VISIBLE; WndTest w = new WndTest; w.createHandle(cp); }
 * Form1 overrides dispose so it can clean up the
 * component list.

/** Container components = new Container; Button button1 = new Button;
 * NOTE: The following code is required by the Visual J++ form
 * designer. It can be modified using the form editor.  Do not
 * modify it using the code editor.

private void initForm {    this.setText("Form1"); this.setAutoScaleBaseSize(new Point(5, 13)); this.setClientSize(new Point(292, 273));

button1.setLocation(new Point(112, 128)); button1.setSize(new Point(75, 23)); button1.setTabIndex(0); button1.setText("button1"); button1.addOnClick(new EventHandler(this.button1_click));

this.setNewControls(new Control[] {button1}); }

/** public static void main(String args[]) {    Application.run(new Form1); } }                        Compile the Java source files. Run Form1. Click the button on the form. This will create a WndTest class with className LISTBOX and style WS_VISIBLE. The WndTest class overrides wndProc such that WM_CREATE is not passed on to defWndProc and everything else is.
 * The main entry point for the application.
 * @param args Array of parameters passed to the application
 * via the command line.
 * via the command line.

WJVIEW causes an unhandled exception.

<div class="references_section">