How to: Access a COM Component Written in VJ++
Common Object Model (COM) objects provide a great way to encapsulate functionality and reuse it across multiple applications. You can use COM objects to expose specific functionality within your application. For example, you can create a set of routines that you want to use in more than one application.
Because COM is not language-specific, COM objects can be easily integrated into applications developed in a variety of programming languages. You can use Visual J# to view and import COM objects that are registered on your system. During the import process, Visual J# creates class wrappers so that you can access COM objects just as you would other objects.
The following example shows you how to create a reference to a COM component in your project.
To import a COM component
From Solution Explorer, right-click on References and select Add Reference.
Click the COM tab to display a list of registered COM objects or other libraries and controls.
Select the component you want to import, and click OK.
The component is displayed in the list of references in Solution Explorer.
To access the COM component in your J# application, add the appropriatestatement, such as import ClockComponent.