HOWTO: Create a CAB That Installs a COM DLL Using the Visual J++ 6.0 IDE
ID: Q247315
|
The information in this article applies to:
-
Microsoft Visual J++, version 6.0
SUMMARY
This article describes an alternative to creating and signing .cab files through the command line.
MORE INFORMATION
Step by Step Instructions:
- Create a new COM DLL project in Visual J++ 6.0.
NOTE: Although we are using a DLL created in Visual J++ 6.0 to illustrate
distributing DLLs in CABs, the DLL could just as easily have been created
in another tool.
- Add the following method to the newly created class.
public String foo(int count){
String retval="";
for(int i=0;i<count;i++){
retval+="Hello! ";
}
return retval;
}
- Right-click the Solution in the Project Explorer and select Add Project.
- Add a new project to the current solution by choosing Visual Studio, select Distribution Units,and click CAB project.
- Right-click the new CAB project in the Project Explorer and select Add Project Outputs.
- Select the original project and click OK.
By default, the COM project generates a DLL and the CAB project places that DLL in to a signed CAB with all the proper permissions and versioning information. Following is a code sample where you can use this new CAB.
Create a new HTML file in the same directory as the generated CAB. The following sample assumes that your CAB is named Cabinet3.cab and that your COM class is named Class1. Please replace the sample ClassID with your own. Your ClassID is listed in the "@com.register" tag within the first block comment in Class1.java.
<HTML>
<script language=javascript for=window event=onload>
<!--
alert(test.foo(3));
//-->
</script>
<BODY>
<OBJECT classid=clsid:C7894A56-A994-11D3-AFDF-0000F8058BF1 id=test VIEWASTEXT>
<PARAM NAME="__CODECLASS" VALUE="Class1">
<PARAM NAME="CABBASE" VALUE="Cabinet3.CAB">
</OBJECT>
You should see a dialog box with the following text: "Hello! Hello! Hello! ".
</BODY>
</HTML>
NOTE: If you include two (or more) DLLs in the CAB, only the first downloads and installs as expected. This is a known issue. To work around this problem, edit the OSD (within the generated CAB) manually and make the two NATIVE XML blocks one large NATIVE block.
© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Joseph B. Hall, Microsoft Corporation
REFERENCES
For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java,
please see the following pages on the Microsoft Technical Support site:
http://support.microsoft.com/support/visualj/
http://support.microsoft.com/support/java/
Additional query words:
Keywords : kbVJ kbVJ600 kbGrpJava kbDSupport
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type : kbhowto