Locclien: Client of Out-of-process Local Server

Click to open or copy the Locclien project files.

Click to open or copy the Include files (required).

Click to open or copy the Library files (required).

Note   To use this sample, you must first build the Marshal sample, and you must build LOCSERVE.EXE before building or running Locclien.

The Locclien sample illustrates how a client can access and control components in an out-of-process local server. This sample presents the same series of automobile-related components that are used in other COM samples. The Locclien/Locserve client/server pair is analogous to the DLLclien/DLLserve pair. The main difference is that Locclien must cross process boundaries to access components in the out-of-process local server Locserve. In contrast, DLLclien can directly access components in the in-process server DLLserve.

The COM objects that Locclien manipulates are the automobile-related components of other samples, with the following interfaces: ICar, IUtility, and ICruise. Locclien works in conjunction with the separate Locserve.exe, which provides the COCar, COUtilityCar, and COCruiseCar COM objects.

Locclien.exe creates its own COUtilityCruiseCar COM object, which is constructed by reusing the COCruiseCar COM object by containment and augmenting it with a native implementation of the IUtility interface. Because the COCruiseCar COM object class is an aggregate—that is, it reuses an inner COCar object by aggregation—Locclien illustrates nesting COM objects by mixed reuse. The composite COUtilityCruiseCar object is constructed by containment reuse of COCruiseCar, another composite COM object. COCruiseCar is constructed by aggregation reuse of the COCar COM object. The composition of COUtilityCruiseCar is also interesting because the COUtilityCruiseCar object's containment of the COCruiseCar object crosses the process boundary between Locclien and the out-of-process local server Locserve.exe. Locclien thus relies on standard marshaling support for the custom interfaces it uses on the COCruiseCar object. This marshaling support is built separately as Marshal.dll in the Marshal sample.

See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.

Building SDK Samples

This sample uses the following keywords:

addref; adjust; checkmenuitem; cimpicar; cimpicruise; cimpiutility; clear; clutch; cmainwindow; cocreateinstance; cofreeunusedlibraries; cogetclassobject; coinitialize; copy; couninitialize; coutilitycruisecar; create; createinstance; createutilitycruisecar; defined; defwindowproc; delete_pointer; dispatchmessage; domenu; engage; errorbox; failed; findwindow; getdc; gethwnd; getinterface; getlasterror; getmenu; getmenustate; getmessage; getsystemmetrics; gettextmetrics; getusername; initapplication; initinstance; loadaccelerators; loadcursor; loadicon; loadimage; loadstringa; log; logerror; logf1; logging; logid; makefamilypath; makeintresource; messageboxa; msg; offroad; outputdebugstring; postmessage; postquitmessage; queryinterface; readhelp; readsource; readtutorial; registerclassex; release; release_interface; releasedc; resize; shift; showdialog; showwindow; speed; stdmethodimp_; steer; style; succeeded; text; translateaccelerator; translatemessage; unicodeok; updatewindow; winch; windowproc; winmain