LOCSERVE - Local Server SUMMARY ======= The LOCSERVE sample begins with the car-related COM Objects of the previous DLLSERVE sample and rehouses them in an out-of-process local server, LOCSERVE.EXE. To do so requires little change to the COM objects themselves (COCar, COUtilityCar, and COCruiseCar). This sample introduces the new facilities to house them in a out-of-process COM server, including class factories for each component. This out-of-process server provides the following components: LocCar, LocUtilityCar, and LocCruiseCar. In the series of COM tutorial code samples, LOCSERVE works with the LOCCLIEN code sample to illustrate LOCSERVE's out-of-process local server facilities for creating components that can be used by an EXE client and the subsequent manipulation of those components by LOCCLIEN.EXE. For functional descriptions and a tutorial code tour of LOCSERVE, see the Code Tour section in LOCSERVE.HTM. For details on setting up the programmatic usage of LOCSERVE, see the Usage section in LOCSERVE.HTM. To read LOCSERVE.HTM, run TUTORIAL.EXE in the main tutorial directory and click the LOCSERVE lesson in the table of lessons. You can also achieve the same thing by clicking the LOCSERVE.HTM file after locating the main tutorial directory in the Windows Explorer. See also LOCCLIEN.HTM in the main tutorial directory for more details on the LOCCLIEN client application and how it works with LOCSERVE.EXE itself. You must build LOCSERVE.EXE before building or running LOCCLIEN. LOCSERVE's makefile automatically registers LOCSERVE's components in the registry. These components must be registered before LOCSERVE is available to outside COM clients as a server for those components. This registration is done using the REGISTER.EXE utility built in the earlier REGISTER lesson. To build or run LOCSERVE, you should build the REGISTER code sample first. As an out-of-process local server, LOCSERVE relies on standard marshaling for clients to use its interfaces across process boundaries. Such standard marshaling for the interfaces used in LOCSERVE's COM objects is provided in the MARSHAL.DLL server built in the previous lesson. To build or run LOCSERVE, you should build the MARSHAL code sample first. For details on setting up your system to build and test the code samples in this COM Tutorial series, see TUTORIAL.HTM. The supplied MAKEFILE is Microsoft NMAKE-compatible. To create a debug build, issue the NMAKE command in the Command Prompt window. Usage ----- LOCSERVE is an application that is meant to be used as an out-of-process COM server. Out-of-process servers like LOCSERVE are registered in the system registry, and LOCSERVE has built-in support for registering its components. It accepts the following command line switches to register and unregister: -RegServer or /RegServer to register -UnregServer or /UnregServer to unregister String matches on these switches are case-insensitive. As an out-of-process server, LOCSERVE also recognizes the standard -Embedding or /Embedding switch, which directs it to run as such a server. In this sample, that means LOCSERVE will run hidden. If you attempt to run LOCSERVE as a stand-alone application, it will exit with an error. You can manually direct LOCSERVE to run visible by starting it with an explicit -Embedding switch on its command line prior to running the LOCCLIEN client. The makefile that builds this sample automatically registers the server in the registry. You can manually initiate its self-registration by issuing the following command at the command prompt in the LOCSERVE directory: nmake register You can also directly invoke the REGISTER.EXE command at the command prompt while in the LOCSERVE directory. ..\register\register.exe locserve.exe These registration commands require a prior build of the REGISTER sample in this series, as well as a prior build of LOCSERVE.EXE. FILES ===== Files Description LOCSERVE.TXT This file. MAKEFILE The generic makefile for building the LOCSERVE.EXE code sample of this tutorial lesson. LOCSERVE.H The include file for the LOCSERVE application. Contains class declarations, function prototypes, and resource identifiers. LOCSERVE.CPP The main implementation file for LOCSERVE.EXE. Has WinMain and CMainWindow implementation, as well as the main menu dispatching. LOCSERVE.RC The resource definition file for the executable. LOCSERVE.ICO The icon resource for the executable. SERVER.H The include file for the server control C++ object. Also used for LOCSERVE externs. SERVER.CPP The implementation file for the server control object. Manages object counts and creation of class factories. FACTORY.H The include file for the server's class factory COM objects. FACTORY.CPP The implementation file for the server's class factories. CAR.H The include file for the COCar COM object class. CAR.CPP The implementation file for the COCar COM object class. UTILCAR.H The include file for the COUtililtyCar COM object class. UTILCAR.CPP The implementation file for the COUtilityCar COM object class. CRUCAR.H The include file for the COCruiseCar COM object class. CRUCAR.CPP The implementation file for the COCruiseCar COM object class.