Microsoft KB Archive/214647

= PRB: Unable to Deploy an ActiveX Control Created Using Visual J++ 6.0 =

Article ID: 214647

Article Last Modified on 6/14/2006

-

APPLIES TO


 * Microsoft Visual J++ 6.0 Standard Edition
 * Microsoft Java Virtual Machine

-



This article was previously published under Q214647



SYMPTOMS
An ActiveX control created using Visual J++ 6.0 fails to load inside the browser when deployed to a client machine or on a Web server.



CAUSE
The following is a checklist that outlines the cause of this problem:
 * Your ActiveX control project is not packaged into a COM DLL.
 * The client machine is running a build of Microsoft virtual machine that is earlier than 2922. Only Microsoft VM builds 2922 and greater support the Windows Foundation Classes for Java (WFC).
 * The machine has a duplicate version of the same ActiveX control in a different directory.



RESOLUTION
A work around is available. See the "More Information" section later in this article for details.



Steps to Reproduce Behavior
 Create the ActiveX control as follows using Visual J++ 6.0:  From the File menu, click New Project. On the New tab, expand the Visual J++ Projects folder and click Components. Click the Control icon. In the Name box, enter a name for your project. In the Location box, enter the path where you want to save your project, or click Browse to navigate to the folder. Click Open. A collapsed view of your project appears in Project Explorer.</li> In Project Explorer, expand the project node. A file with the default name of Control1.java has been added to your project.</li></ul> </li> Use the following steps to expose this control as an ActiveX control: <ul> On the Project menu, click Project Properties to bring up the Project Properties dialog box.</li> Select the COM Classes tab in the Project Properties dialog box.</li> In the COM Classes tab, click Automatically generate Type Library.</li> Select the class you wish to make a COM class.</li> By default, Visual J++ creates a type library file based on the name of the project.</li></ul> </li> Modify your new Control and add it to a new form. <ul> Open your control in Forms Designer and add an EditBox and Button control to it.</li> Find the click event on your Button control and and enter OnClick for the name of the method that will handle the event. When you press ENTER, the Text editor opens to an empty event handler named OnClick.</li>  Include the following to the event handler: private void OnClick(Object source, Event e) { edit1.setText("This is a test"); }                               </li> Build the control.</li> To add the control to the ToolBox, click the Tools menu, and select Customize ToolBox.</li> Add a Form to your project.</li> Add the control to your Form.</li> <li>Build and Run the Form.</li></ul> </li> <li>Package your Control Project into a Cab Archive as follows: <ul> <li>On the Project menu, click Project Properties to open the Project Properties dialog box.</li> <li>Select the Output Format tab.</li> <li>Select Enable Packaging and select Cab Archive(.CAB) as the packaging type.</li></ul> </li> <li>Rebuild your Control Project.</li> <li> Create an HTML file as follows that references your control and the CAB file: <HTML> <HEAD> <TITLE> Deploy WFC ActiveX Control </TITLE> </HEAD> <BODY> <OBJECT id="JavaCtl" classid="CLSID:5D178FF9-AF1B-11D2-BAEE-0000F87A47A8" codeBase="JavaCtl.CAB#version=1,0,0,1"> </OBJECT> </BODY> </HTML> </li> <li>Launch the HTML file.</li> <li>This opens the Signing Certificate, but fails to load your ActiveX control.</li></ol>

Workaround
Replace steps 4-8 with the following: <ol> <li>Package your Control Project into a COM DLL as follows: <ul> <li>On the Project menu, click Project Properties to open the Project Properties dialog box.</li> <li>Select the Output Format tab.</li> <li>Select Enable Packaging and select COM DLL as the packaging type.</li></ul> </li> <li>Rebuild your Control Project.</li> <li>Create another new Project. <ul> <li>Select Visual Studio and click the Distribution Units node.</li> <li>Select Cabinet(CAB).</li></ul> </li> <li>Add items to your new CAB file. <ul> <li>From the Project menu, click Add Item.</li> <li>Include the DLL you created earlier.</li></ul> </li> <li>Rebuild the Cabinet File Project.</li> <li> Create a HTML file as follows that references your control and the CAB file: <HTML> <HEAD> <TITLE> Deploy WFC Activex Control </TITLE> </HEAD> <BODY> <OBJECT id="JavaCtl" classid="CLSID:5D178FF9-AF1B-11D2-BAEE-0000F87A47A8" codeBase="JavaCtl.CAB#version=1,0,0,1"> </OBJECT> </BODY> </HTML> </li> <li>Launch the HTML file.</li></ol>

The ActiveX Control loads as expected. NOTE: To deploy this ActiveX Control to another machine or Web server, copy the .html file and the .CAB file.

<div class="references_section">