Share via


Visual Basic Concepts

In-Process and Out-of-Process Servers

ActiveX components interact with your application — and with each other — through a client/server relationship. The client is the application code or component that uses the features of a component. The server is the component and its associated objects. For example, suppose your application uses an ActiveX control to provide a standard Employee form for multiple applications in your company. The ActiveX control that provides the Employee form is the server; the applications that use the control are its clients.

Depending on how an ActiveX component has been implemented, it may run in the same process as its client applications, or in a different process. For example, if your application uses a component that is part of an ActiveX-enabled application, it runs in a separate process. If the component has been implemented as a programmable object in a dynamic-link library (.dll file), it runs in the same process as your application.

In general, if an ActiveX component has been implemented as part of an executable file (.exe file), it is an out-of-process server and runs in its own process. If it has been implemented as a dynamic-link library, it is an in-process server and runs in the same process as the client application. Applications that use in-process servers usually run faster than those that use out-of-process servers because the application doesn't have to cross process boundaries to use an object's properties, methods, and events.

The following table shows how you can implement the different types of components:

Component Server Type
ActiveX-enabled application Out-of-process
Code component Either in-process or out-of-process
ActiveX control In-process
ActiveX document Either in-process or out-of-process

Using in-process components is one way to optimize the performance of your application. Another way to optimize performance is to use early binding. For more information, see "Speeding Object References" later in this chapter.