LABRADOR: Implements a Server with No User Interface

Click to open or copy the LABRADOR project files.

This sample shows how to use ATL to implement an EXE server without any user interface. The server allows creation of an object that supports two custom interfaces, defined in Labrador.idl.

Running the Sample

You need to build and set up three components: the server, the marshalling DLL, and the driver.

The Server

  1. Open the Labrador.dsw file in Visual C++ and build the Labrador.exe.

  2. Run the server once with the /RegServer command-line option to set up the registry (for convenience, a custom build rule does this for you).

The Marshalling DLL

  1. Build the proxy/stub marshalling DLL, Labps.dll, by running NMAKE from the command line:
    NMAKE -f labps.mak

  2. Register the DLL by running REGSVR32 from the command line:
    REGSVR32 labps.dll

The Driver

  1. Go to the LABDRIV subdirectory open the Labdriv.dsw project file in Visual C++ and build Labdriv.exe.

  2. Run the driver from the debugger or from the command line. The driver will create an object, make a few calls into it, and then release it.

This sample uses the following keywords:

_CrtDumpMemoryLeaks; _tcsicmp; _tcstok; _tprintf; _vstprintf; ATLASSERT; BEGIN_COM_MAP; BEGIN_OBJECT_MAP; CComModule::Init; CComModule::RegisterClassObjects; CComModule::RevokeClassObjects; CComModule::Unlock; CComModule::UnregisterServer; CComObjectRoot; CoCreateInstance; COM_INTERFACE_ENTRY; CoUninitialize; DECLARE_NOT_AGGREGATABLE; DECLARE_REGISTRY; DispatchMessage; END_OBJECT_MAP; GetCurrentThreadId; GetMessage; OBJECT_ENTRY; OutputDebugString; PostThreadMessage; Trace; va_end; va_list; va_start; wcscpy