Click to open or copy the Freserve project files.
Click to open or copy the Include files (required).
Click to open or copy the Library files (required).
Note To use this sample, you must first build the Register sample.
The Freserve sample shows how to construct a COM object in a free-threaded in-process server. This sample departs from the truck 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.
The CThreaded facility in Apputil is used to achieve thread safety as it is in the 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 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.
See the parent topic, COM Tutorial Samples, to download global tutorial files or any HTML files about this sample.
This sample uses the following keywords:
addref; addregnamedvalue; canunloadnow; cballthread; cfball; checkbounce; cimpiball; cimpiclassfactory; clear; coball; createinstance; cserver; cxform; defined; delete_pointer; dllcanunloadnow; dllgetclassobject; dllmain; dllregisterserver; dllunregisterserver; failed; findthread; getball; getcurrentthreadid; getdimensions; getdirection; getlasterror; getmodulefilename; getposition; getusername; lock; lockserver; lrandom; lstrcat; lstrcpy; lstrlen; max; move; objectsdown; objectsup; ownthis; point; queryinterface; regclosekey; regcreatekeyex; regdeletekey; regopenkeyex; regsetvalueex; release; reset; rgb; scale; setdimensions; setdirection; setposition; setregkeyvalue; stdentry_; stdmethodimp_; stringfromguid2; text; trans; unicodeok; unlock; unownthis; wsprintf