LABRADOR Attributes Sample: Implements a Server with No User Interface

The LABRADOR attributes 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.

Security noteSecurity Note

This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.

To get samples and instructions for installing them:

To access samples from Visual Studio

  • On the Help menu, click Samples.

    By default, these samples are installed in drive:\Program Files\Microsoft Visual Studio 10.0\Samples\.

  • For the most recent version of this sample and a list of other samples, see Visual Studio Samples on the MSDN Web site.

This sample uses three components: the server, the marshaling DLL, and the driver.

To build and register the components

  1. Open the solution file Labrador.sln

  2. From the Build menu, click Build Solution.

    The server, the marshaling DLL, and the driver will be built and registered.

To run the driver

  1. In Solution Explorer, right-click the labdriv project and select Set as StartUp Project.

  2. From the Debug menu, click Start Without Debugging.

    The driver will create an object, make a few calls into it, and then release it.

This sample uses the following attributes:

aggregatable, coclass, default, emitidl, helpstring, in, module, object, out, progid, string, threading, uuid, version, vi_progid

This sample uses the following keywords:

_CrtDumpMemoryLeaks; _tcsicmp; _tcstok; _tprintf; _vstprintf; ATLASSERT; BEGIN_COM_MAP; BEGIN_OBJECT_MAP; 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_s


Some of the samples, such as this one, have not been modified to reflect the changes in the Visual C++ wizards, libraries, and compiler, but still demonstrate how to complete your desired task.