home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Press 1997 July
/
Sezamfile97_2.iso
/
windows
/
program
/
activex
/
axtsamp.exe
/
TSBRANCH.EXE
/
DLLSERVE
/
DLLSERVE.TXT
< prev
next >
Wrap
Text File
|
1997-01-05
|
5KB
|
91 lines
DLLSERVE - COM Server in a DLL
SUMMARY
=======
The DLLSERVE sample begins with the car-related COM Objects of the previous
COMOBJ lesson and refashions them into components. To do so requires little
change to the COM objects themselves (COCar, COUtilityCar, and COCruiseCar).
But to envelop them as components, this lesson introduces new facilities to
house them in a DLL COM server. These facilities include class factories for
each component and a CarSample utility component that allows clients to see
logged behavior in the server itself.
The DLL server provides the following components: Car, UtilityCar, CruiseCar,
and CarSample.
In the series of ActiveX tutorial code samples, DLLSERVE works with the
DLLCLIEN code sample to illustrate DLLSERVE's COM server facilities for
creating components that can be used by an EXE client and the subsequent
manipulation of those components by DLLCLIEN.EXE.
For functional descriptions and a tutorial code tour of DLLSERVE, see the
Code Tour section in DLLSERVE.HTM. For details on setting up the
programmatic usage of DLLSERVE, see the Usage section in DLLSERVE.HTM. To
read DLLSERVE.HTM, run TUTORIAL.EXE in the main tutorial directory and
click the DLLSERVE lesson in the table of lessons. You can also achieve
the same thing by clicking the DLLSERVE.HTM file after locating the main
tutorial directory in the Windows Explorer. See also DLLCLIEN.HTM in the
main tutorial directory for more details on the DLLCLIEN client
application and how it works with DLLSERVE.DLL.
You must build DLLSERVE.DLL before building or running DLLCLIEN.
DLLSERVE's makefile automatically registers DLLSERVE's components in the
registry. These components must be registered before DLLSERVE is available
to outside COM clients as a server for those components. This registration
is done using the REGISTER.EXE utility built in the previous REGISTER
lesson. To build or run DLLSERVE, you should build the REGISTER code
sample first.
For details on setting up your system to build and test the code samples in
this ActiveX 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
-----
DLLSERVE is a DLL that is meant to be used primarily as a COM server.
Though it can be implicitly loaded by linking to its associated .LIB file,
it is normally used after an explicit LoadLibrary call (usually from COM's
CoGetClassObject function). Servers like DLLSERVE are registered in the
registry. To use DLLSERVE in a COM client program, a client does not need
to include DLLSERVE.H or link to DLLSERVE.LIB. A COM client of DLLSERVE
obtains access solely through its components' CLSIDs and COM services. For
DLLSERVE, those CLSIDs are CLSID_DllCar, CLSID_DllUtilityCar,
CLSID_DllCruiseCar, and CLSID_DllCarSample. The DLLCLIEN lesson shows how
this is done.
FILES
=====
Files Description
DLLSERVE.TXT This file.
MAKEFILE The generic makefile for building the DLLSERVE.DLL
code sample of this tutorial lesson.
DLLSERVE.H The include file for declaring as imported or defining as
exported the service functions in DLLSERVE.DLL.
DLLSERVE.CPP The main implementation file for DLLSERVE.DLL. Has DllMain
and the COM server functions (for example, DllGetClassObject).
DLLSERVE.RC The DLL resource definition file for the executable.
DLLSERVE.ICO The icon resource for the executable.
SERVER.H The include file for the server control C++ object. Also has
resource identifiers for resources stored inside DLLSERVE.DLL
and other external declarations that are used internally
within the modules of DLLSERVE.DLL.
SERVER.CPP The implementation file for the server control object.
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.
SAMPLE.H The include file for the COCarSample COM object class.
SAMPLE.CPP The implementation file for the COCarSample COM object class.