Remclien: Distributed COM (DCOM) Remote Client

Click to open or copy the Remclien 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 Register and Marshal samples on your client machine and the Register, Marshal, and Aptserve samples on your server machine.

The Remclien sample shows how a client can access and control components in an out-of-process remote server. This sample uses the out-of-process server Aptserve, but here Aptserve is accesses across machine boundaries by Remclien. In other samples, Aptclien accessed Aptserve’s components on the same machine by crossing only process and thread boundaries.

No changes to Aptserve are required for Remclien to work. Distributed COM (DCOM) supports local/remote transparency between client and server.

The Remclien sample presents the automobile-related components that are demonstrated in other COM samples. These COM objects use the following interfaces: ICar, IUtility, and ICruise. Remclien works in conjunction with the separate Aptserve.exe, which provides the COCar, COUtilityCar, and COCruiseCar COM objects.

Remclien.exe creates its own COUtilityCruiseCar COM object 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 a composite, that is, it reuses an inner COCar object by containment, Remclien illustrates nested reuse of COM objects. The composite COUtilityCruiseCar object reuses COCruiseCar, another composite COM object, by containment. COCruiseCar further reuses the COCar COM object by containment.

The composition of COUtilityCruiseCar is also interesting because the COUtilityCruiseCar object's containment of the COCruiseCar object crosses the machine boundary between Remclien and the out-of-process remote server Aptserve.exe. Remclien uses 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; ansitouc; checkmenuitem; cimpicar; cimpicruise; cimpiutility; clear; clutch; cmainwindow; cofreeunusedlibraries; cogetclassobject; coinitialize; copy; couninitialize; coutilitycruisecar; create; createinstance; createremote; createutilitycruisecar; dcomok; defined; defwindowproc; delete_pointer; dialogproc; dispatchmessage; domenu; enddialog; engage; errorbox; failed; getdc; getdlgitem; getdlgitemtext; gethwnd; getinterface; getlasterror; getmenu; getmenustate; getmessage; getsystemmetrics; gettextmetrics; getusername; initapplication; initinstance; loadaccelerators; loadcursor; loadicon; loadimage; loadstringa; log; logerror; logf1; logging; logid; makefamilypath; makeintresource; memset; messageboxa; msg; offroad; postmessage; postquitmessage; queryinterface; readhelp; readsource; readtutorial; registerclassex; release; release_interface; releasedc; resize; setcursor; setdlgitemtext; setfocus; shift; showdialog; showwindow; speed; stdmethodimp_; steer; style; succeeded; text; translateaccelerator; translatemessage; unicodeok; updatewindow; winch; windowproc; winmain