Visual Basic Reference

Interface Sample Application (Intr_Svr.vbp and Intr_Cli.vbp), Enterprise Edition

See Also

This sample demonstrates a way to make more efficient user of COM's apartment model resource allocation algorithm when the context of an entire project needs to be preserved for a specific client.

The server in this project does not have a form module, and as such, will not be visible on the machine it is running on. (When a client has an active reference to it, however, it can be seen in the running task list.)

File Description
Intr_cli.vbp Client component project file.
Intr_cli.frm Client main form.
Intr_svr.bas Server main/global utility module.
Intr_svr.cls A public interface class module that clients use to access the private classes of this component.
Getdate.cls A private class that returns the current date.
Gettime.cls A private class that returns the current time.
Intrface.txt A text file with a project overview and description.

To Run

From the Visual Basic File menu, choose Open Project and select the Intr_svr.vbp file, which is listed in the Samples directory. Press F5 or choose Start from the Run menu to run the server project.

Once running, this project temporarily registers its classes in the system registry. You can then start a second instance of Visual Basic to run Intr_cli.vbp, the client that uses the class modules defined in Intr_svr.vbp.

Note   The Automation server can be run on the same machine as the client, or it can be run on a remote machine to benefit from distributed processing power and support multi-user access. The Automation server does not need to be recompiled or changed in any way to support this location independence.