home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Press 1997 July
/
Sezamfile97_2.iso
/
windows
/
program
/
activex
/
axtsamp.exe
/
TSBRANCH.EXE
/
FRESERVE
/
FRESERVE.TXT
< prev
next >
Wrap
Text File
|
1997-01-05
|
5KB
|
94 lines
FRESERVE - Free-threaded COM objects in an in-process server
SUMMARY
=======
The FRESERVE sample shows how to construct a COM object in a free-threaded
in-process server. This sample departs from the sport utility vehicle
metaphor and associated interfaces used in other samples of this series.
FRESERVE introduces a new custom interface, IBall, and a new COM object,
COBall. COBall implements the IBall interface. Both COBall and its
in-process server are coded to support COM free threading in anticipation
of their use by the free-threaded client, FRECLIEN, in the next lesson.
The CThreaded facility in APPUTIL is used to achieve thread safety as it
was in the previous APTSERVE sample. COBall objects are derived from the
CThreaded class and so inherit its OwnThis and UnOwnThis methods. These
methods enforce mutually exclusive access to the FRESERVE server and to
free-threaded COBall objects managed by the server.
FRESERVE works with the FRECLIEN code sample to illustrate FRESERVE's COM
server facilities in a free-threaded server and the subsequent manipulation
of its components by a free-threaded client.
For functional descriptions and a tutorial code tour of FRESERVE, see the
Code Tour section in FRESERVE.HTM. For details on setting up the
programmatic usage of FRESERVE, see the Usage section in FRESERVE.HTM. To
read FRESERVE.HTM, run TUTORIAL.EXE in the main tutorial directory and
click the FRESERVE lesson in the table of lessons. You can also achieve
the same thing by clicking the FRESERVE.HTM file after locating the main
tutorial directory in the Windows Explorer. See also FRECLIEN.HTM in the
main tutorial directory for more details on the FRECLIEN client
application and how it works with FRESERVE.DLL. You must build
FRESERVE.DLL before building or running FRECLIEN.
FRESERVE's makefile automatically registers FRESERVE's DllBall component
in the registry. This component must be registered before FRESERVE is
available to outside COM clients as a server for that component. This
self-registration is done using the REGISTER.EXE utility built in the
previous REGISTER lesson. To build or run FRESERVE, 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
-----
FRESERVE is a DLL that is intended primarily as a free-threaded COM
server. Although it can be implicitly loaded by linking to its associated
.LIB file, it is normally used after an explicit LoadLibrary call, usually
from within COM's CoGetClassObject function. FRESERVE is a
self-registering in-process server. The makefile that builds this sample
automatically registers this server in the registry. You can manually
initiate its self registration by issuing the following command at the
command prompt:
nmake register
This registration process requires a prior build of the REGISTER sample
in this series.
To use FRESERVE, a client program does not need to include FRESERVE.H or
link to FRESERVE.LIB. A COM client of FRESERVE obtains access solely
through its component's CLSID and COM services. For FRESERVE, that CLSID
is CLSID_DllBall (defined in file BALLGUID.H in the INC sibling
directory). The FRECLIEN code sample shows how the client obtains this
access.
FILES
=====
Files Description
FRESERVE.TXT This file.
MAKEFILE The generic makefile for building the FRESERVE.DLL
code sample of this lesson.
FRESERVE.H The include file for declaring as imported or defining as
exported the service functions in FRESERVE.DLL.
FRESERVE.CPP The main implementation file for FRESERVE.DLL. Has DllMain
and the COM server functions (for example, DllGetClassObject).
FRESERVE.RC The DLL resource definition file for the executable.
FRESERVE.ICO The icon resource for the executable.
SERVER.H The include file for the server control C++ object.
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.
BALL.H The include file for the COBall COM object class.
BALL.CPP The implementation file for the COBall COM object class.