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

  1. /*+==========================================================================
  2.   File:      SERVER.H
  3.  
  4.   Summary:   Internal include file for the PERTEXT.DLL server code sample.
  5.              Contains class declarations, resource IDs and string macros
  6.              for internal use in constructing this DLL as a COM component
  7.              server.  Declares the CServer server control object class.
  8.              The CThreaded OwnThis mechanism is used to ensure mutually
  9.              exclusive access to this CServer object by multiple threads.
  10.  
  11.              For a comprehensive tutorial code tour of this module's
  12.              contents and offerings see the tutorial PERTEXT.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 DLLSERVE 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 PERTEXT modules to get at the globals.
  83. extern CServer* g_pServer;
  84.  
  85.  
  86. #endif // SERVER_H
  87.