Dispatch Sample

This sample is located in \Samples\Com\Dispatch.

Description
Using the Sample
Key Project Files
Technologies Demonstrated

Description

This sample uses a Java-implemented COM object and a Java client that use the com.ms.com.Dispatch class to pass strings and arrays of Java objects. This technique allows the passing of information without generating a type library. However, method calls that use the IDispatch interface rather than virtual tables are slower. Moreover, incorrect method names or parameter combinations in these IDispatch method calls generate application runtime errors rather than compile-time errors.

Using the Sample

To compile the sample

Use Nmake.exe to compile the makefile in the \Samples\Com\Dispatch directory.

To install the sample

From \Samples\Com\Dispatch, run Register.bat.

This displays a message indicating that the COM object was registered correctly.

To uninstall the sample

From \Samples\Com\Dispatch, run Remove.bat.

This displays a message indicating that the COM object was removed correctly.

To run the Inproc sample

From \Samples\Com\Dispatch, run the following command:

jview sample.dcom.InprocDClient

If successful, output from the COM object and the Client is displayed. The last message will be InprocClient - Done.

To run the Local Server sample

From \Samples\Com\Dispatch, run the following command:

jview sample.dcom.OutprocDClient

If successful, output from the COM object and the Client is displayed. The last message will be OutprocClient - Done.

Key Project Files

Hub3.java

This class contains the implementation of a simple Java/COM object.

InprocDClient.java

This class creates an instance of the Java/COM object in process using CoCreateInstanceEx from Microsoft® J/Direct™ and used by the com.ms.com.Dispatch class through its IDispatch interface.

OutprocDClient.java

This class creates an instance of the Java/COM object out-of-process using CoCreateInstanceEx from J/Direct and used by the com.ms.com.Dispatch class through its IDispatch interface.

Technologies Demonstrated

COM

This sample shows how to:

© 1999 Microsoft Corporation. All rights reserved. Terms of use.