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

  1. /*+==========================================================================
  2.   File:      SERVER.H
  3.  
  4.   Summary:   Internal include file for the LICSERVE.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 to control server object and lock
  9.              counts as well as server licensing.
  10.  
  11.              For a comprehensive tutorial code tour of this module's
  12.              contents and offerings see the tutorial LICSERVE.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: none
  20.  
  21.   Origin:    10-5-95: atrent - Editor-inheritance from CAR.H in
  22.                the COMOBJ 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. // String Macros.
  44. #define ABOUT_TITLE_STR  "LICSERVE: Tutorial Code Sample"
  45. #define LICENSE_EXT_STR  ".LIC"
  46.  
  47. #define MAX_LICENSEKEY              128
  48.  
  49. // Dialog IDs.
  50. #define IDD_ABOUTBOX                1000
  51.  
  52. // Error-related String Identifiers.
  53. #define IDS_ASSERT_FAIL             2200
  54.  
  55. #ifdef __cplusplus
  56.  
  57. /*C+C+++C+++C+++C+++C+++C+++C+++C+++C+++C+++C+++C+++C+++C+++C+++C+++C+++C+++C
  58.   Class:    CServer
  59.  
  60.   Summary:  Class to encapsulate control of this COM server (eg, handle
  61.             Lock and Object counting, encapsulate otherwise global data).
  62.  
  63.   Methods:  none
  64. C---C---C---C---C---C---C---C---C---C---C---C---C---C---C---C---C---C---C-C*/
  65. class CServer
  66. {
  67.   public:
  68.     CServer(void);
  69.     ~CServer(void);
  70.  
  71.     void Lock(void);
  72.     void Unlock(void);
  73.     void ObjectsUp(void);
  74.     void ObjectsDown(void);
  75.     BOOL CheckLicense(void);
  76.  
  77.     // A place to store the handle to loaded instance of this DLL module.
  78.     HINSTANCE m_hDllInst;
  79.  
  80.     // A place to store a client's parent window.
  81.     HWND m_hWndParent;
  82.  
  83.     // A Pointer to a Message Box object.
  84.     CMsgBox* m_pMsgBox;
  85.  
  86.     // Global DLL Server living Object count.
  87.     LONG m_cObjects;
  88.  
  89.     // Global DLL Server Client Lock count.
  90.     LONG m_cLocks;
  91.  
  92.     // The Machine License key string for the LICSERVE server.
  93.     CHAR m_szLicenseKey[MAX_LICENSEKEY];
  94.  
  95.     // Length of the global g_szLicenseKey string.
  96.     UINT m_cLicenseLen;
  97.  
  98.     // Machine license verified.
  99.     BOOL m_bLicensed;
  100. };
  101.  
  102. #endif // __cplusplus
  103.  
  104. // Allow other internal LICSERVE modules to get at the globals.
  105. extern CServer* g_pServer;
  106. extern CMsgLog* g_pMsgLog;
  107.  
  108.  
  109. #endif // SERVER_H
  110.