|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
LABRADOR Sample: Implements a Server with No User Interface
Updated: April 2009
The LABRADOR 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.
The LABRADOR attributes sample is the attributed version of this sample.
This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.
To get samples and instructions for installing them:
On the Visual Studio Help menu, click Samples.
For more information, see Visual Studio Samples.
The most recent version and complete list of samples is available online from the Visual Studio 2008 Samples page.
You can also locate samples on your computer's hard disk. By default, samples and a Readme file are copied into a folder under \Program Files\Visual Studio 9.0\Samples\. For Express editions of Visual Studio, all samples are located online.
This sample uses three components: the server, the marshaling DLL, and the driver.
To build and register the components
Open the solution file Labrador.sln
From the Build menu, click Build Solution.
The server, the marshaling DLL, and the driver will be built and registered.
To run the driver
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 keywords:
_CrtDumpMemoryLeaks; _tcsicmp; _tcstok; _tprintf; _vstprintf; ATLASSERT; BEGIN_COM_MAP; BEGIN_OBJECT_MAP; 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