home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / mts4.cab / TServer_Computer.h < prev    next >
C/C++ Source or Header  |  1997-11-14  |  2KB  |  72 lines

  1. // Filename: Computer.h
  2. //
  3. // Description:  Definition of CComputer
  4. //
  5. // This file is provided as part of the Microsoft Transaction Server Samples
  6. //
  7. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT 
  8. // WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 
  9. // INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES 
  10. // OF MERCHANTABILITY AND/OR FITNESS FOR A  PARTICULAR 
  11. // PURPOSE.
  12. //
  13. // Copyright (C) 1997 Microsoft Corporation, All rights reserved
  14.  
  15. #if !defined(AFX_COMPUTER_H__AA22C9A7_FD72_11D0_B5DC_00C04FB957D8__INCLUDED_)
  16. #define AFX_COMPUTER_H__AA22C9A7_FD72_11D0_B5DC_00C04FB957D8__INCLUDED_
  17.  
  18. #if _MSC_VER >= 1000
  19. #pragma once
  20. #endif // _MSC_VER >= 1000
  21.  
  22. #include "resource.h"       // main symbols
  23.  
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CComputer
  26.  
  27. class CComputer : 
  28.     public CComDualImpl<IComputer, &IID_IComputer, &LIBID_TSERVERLib>, 
  29.     public ISupportErrorInfo,
  30.     public CComObjectRoot,
  31.     public CComCoClass<CComputer,&CLSID_Computer>
  32. {
  33. public:
  34.     CComputer() {}
  35.  
  36. private:
  37.     long plField [3][3];
  38.  
  39.     float CComputer::Evaluate (long lX, long lY);
  40.     long CComputer::LineScan (long lPlayer, long& lX, long& lY);
  41.     bool CComputer::IsWin (long lPlayer);
  42.     long CComputer::HowManyTurns ();
  43.     void CComputer::GetMove (long lGameID, VARIANT_BOOL bEasy, long& lX, long& lY);
  44.     HRESULT CComputer::LoadArray (long lGameID);
  45.     HRESULT CComputer::SaveArray (long lGameID); 
  46.     void inline CComputer::InitArray () {
  47.         for (int i = 0; i < 3; i ++)
  48.             for (int j = 0; j < 3; j ++)
  49.                 plField[i][j] = 0;
  50.     }
  51.  
  52. BEGIN_COM_MAP(CComputer)
  53.     COM_INTERFACE_ENTRY(IDispatch)
  54.     COM_INTERFACE_ENTRY(IComputer)
  55.     COM_INTERFACE_ENTRY(ISupportErrorInfo)
  56. END_COM_MAP()
  57. //DECLARE_NOT_AGGREGATABLE(CComputer) 
  58. // Remove the comment from the line above if you don't want your object to 
  59. // support aggregation. 
  60.  
  61. DECLARE_REGISTRY_RESOURCEID(IDR_Computer)
  62. // ISupportsErrorInfo
  63.     STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  64.  
  65. // IComputer
  66. public:
  67.     STDMETHODIMP AddNewGame (IN VARIANT_BOOL bEasy, OUT VARIANT* pvGameID, OUT VARIANT* pvOrder, OUT VARIANT* pvX, OUT VARIANT* pvY);
  68.     STDMETHODIMP NewMove (IN long lGameID, IN VARIANT_BOOL bEasy, IN long lX, IN long lY, OUT VARIANT* pvMyX, OUT VARIANT* pvMyY, OUT VARIANT* pvWin);
  69.  
  70. };
  71.  
  72. #endif // !defined(AFX_COMPUTER_H__AA22C9A7_FD72_11D0_B5DC_00C04FB957D8__INCLUDED_)