This article has four sections:
To see:
See the
To see the sample as a standalone
The CabAndSign sample demonstrates how the Cabinet Development Kit and the Code Sign Kit are used to create signed cabinet (CAB) files. Signed CAB files are required if a Java applet is to use COM components.
BEEPER.DLL is a simple Automation server. It is one of the samples from the ActiveX™ Template Library (ATL). You can download ATL from the Web (www.microsoft.com/visualc/v42/atl/).
Beeper has two methods and one property of interest.
javabeep creates a Beeper object (COM component). It calls the Beep method of Beeper in response to mouseDown events. If the call succeeds, Beeper plays the default system sound. javabeep then calls getItem to get a series of strings from Beeper. It displays the set of strings at the location of the mouseDown. If the call fails (as it will every sixth time), no system sound occurs. In response, javabeep places an error message at the location of the mouseDown event.
See javabeep.start for creating the beeper COM component. See javabeep.mouseDown for the calls to the beeper COM component and handling the failure of the call to Beep. Use ClassView to help you find these methods.
COM components can access any system resources. As such, they are both very powerful and potentially very dangerous. In the Java virtual machine (VM) in Microsoft® Internet Explorer 3.0 only trusted class files can use COM components. Class files from digitally signed CAB files are trusted.
If the HTML file is run from Microsoft Developer Studio, the class files are also trusted. This can be very helpful during applet development. However, to deliver your applet to other users, you must put it in a signed CAB file.
The code for the applet itself is taken from the JavaBeep sample. For more information on the Java code and the server, see the JavaBeep sample.
Return to the top of this article.
To run the CabAndSign sample:
To create your own CAB file and sign it:
To use the .CLASS files from a CAB file:
For example:
<param name="cabbase" value="firstcab.cab">
Return to the top of this article.
If you did not see the certificate:
If you get the error message ClassNotFoundException:
If you get the error message UnsatisfiedLinkError:
Return to the top of this article.
This sample includes the following files.
Primary files:
Project files:
Support files:
Return to the top of this article.