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 / perserve / server.h < prev   
Encoding:
C/C++ Source or Header  |  1997-08-30  |  2.9 KB  |  88 lines

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