home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / tutsamp / perdraw / server.h < prev   
C/C++ Source or Header  |  1997-08-30  |  3KB  |  87 lines

  1. /*+==========================================================================
  2.   File:      SERVER.H
  3.  
  4.   Summary:   Internal include file for the PERDRAW.DLL server code sample.
  5.              Contains class declarations and macros for internal use in
  6.              constructing this DLL as a COM component server.  Declares
  7.              the CServer server control object class. APPUTIL's CThreaded
  8.              OwnThis mechanism is used to ensure mutually exclusive access
  9.              to the server by contending multiple threads.
  10.  
  11.              For a comprehensive tutorial code tour of this module's
  12.              contents and offerings see the tutorial PERDRAW.HTM
  13.              file. For more specific technical details on the internal
  14.              workings see the comments dispersed throughout the module's
  15.              source code.
  16.  
  17.   Classes:   CServer.
  18.  
  19.   Functions: .
  20.  
  21.   Origin:    5-20-97: atrent - Editor-inheritance from SERVER.H in
  22.                the STOSERVE Tutorial Code Sample.
  23.  
  24. ----------------------------------------------------------------------------
  25.   This file is part of the Microsoft COM Tutorial Code Samples.
  26.  
  27.   Copyright (C) Microsoft Corporation, 1997.  All rights reserved.
  28.  
  29.   This source code is intended only as a supplement to Microsoft
  30.   Development Tools and/or on-line documentation.  See these other
  31.   materials for detailed information regarding Microsoft code samples.
  32.  
  33.   THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  34.   KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  35.   IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  36.   PARTICULAR PURPOSE.
  37. ==========================================================================+*/
  38.  
  39.  
  40. #if !defined(SERVER_H)
  41. #define SERVER_H
  42.  
  43.  
  44. #ifdef __cplusplus
  45.  
  46. /*C+C+++C+++C+++C+++C+++C+++C+++C+++C+++C+++C+++C+++C+++C+++C+++C+++C+++C+++C
  47.   Class:    CServer
  48.  
  49.   Summary:  Class to encapsulate control of this COM server (eg, handle
  50.             Lock and Object counting, encapsulate otherwise global data).
  51.  
  52.   Methods:  none
  53. C---C---C---C---C---C---C---C---C---C---C---C---C---C---C---C---C---C---C-C*/
  54. class CServer : public CThreaded
  55. {
  56.   public:
  57.     CServer(void);
  58.     ~CServer(void);
  59.  
  60.     // Methods for server lifetime control: object counts and lock counts.
  61.     void Lock(void);
  62.     void Unlock(void);
  63.     void ObjectsUp(void);
  64.     void ObjectsDown(void);
  65.     HRESULT CanUnloadNow(void);
  66.  
  67.     // A place to store the handle to loaded instance of this DLL module.
  68.     HINSTANCE m_hDllInst;
  69.  
  70.     // A place to store a client's parent window.
  71.     HWND m_hWndParent;
  72.  
  73.     // Global DLL Server living Object count.
  74.     LONG m_cObjects;
  75.  
  76.     // Global DLL Server Client Lock count.
  77.     LONG m_cLocks;
  78. };
  79.  
  80. #endif // __cplusplus
  81.  
  82. // Allow other internal PERDRAW modules to get at the globals.
  83. extern CServer* g_pServer;
  84.  
  85.  
  86. #endif // SERVER_H
  87.