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 / conserve / server.h < prev   
C/C++ Source or Header  |  1997-08-30  |  3KB  |  89 lines

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