home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 December / PCWKCD1296.iso / vjplusb / activex / inetsdk / samples / axscript / spruuids / src / app.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-15  |  4.3 KB  |  114 lines

  1. //---------------------------------------------------------------------------
  2. // App.h
  3. //---------------------------------------------------------------------------
  4. // Sample spr program
  5. //---------------------------------------------------------------------------
  6. // (C) Copyright 1992-1996 by Microsoft Corporation.  All rights reserved.
  7. //
  8. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 
  9. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 
  10. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 
  11. // PARTICULAR PURPOSE.
  12. //---------------------------------------------------------------------------
  13.  
  14.  
  15. //---------------------------------------------------------------------------
  16. // Globals
  17. //---------------------------------------------------------------------------
  18. extern class CApp *g_papp;
  19. extern char       *g_pszCodeFile;
  20. extern char       *g_pszRecFile;
  21. extern int         g_mode;
  22.  
  23. #define MODE_NORMAL     0
  24. #define MODE_PLAYBACK   1
  25. #define MODE_RECORD     2
  26.  
  27.  
  28. //---------------------------------------------------------------------------
  29. // Events on client of App
  30. //---------------------------------------------------------------------------
  31. BOOL    AppEvt_Pause(int pause);
  32. BOOL    AppEvt_FQueryTerminate(BOOL fPromptUser);
  33. void    AppEvt_NewGame();
  34. BOOL    AppEvt_DlgProc(  HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
  35. LRESULT AppEvt_PSWndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
  36.  
  37.  
  38. //---------------------------------------------------------------------------
  39. // App class
  40. //---------------------------------------------------------------------------
  41. class CApp : public ISpruuidsApp, public IOleComponent, public COleAuto
  42.   {
  43. public:
  44.   // *** Constructor / Descructor ***
  45.   static HRESULT CreateApp(HINSTANCE hinst);
  46.   CApp(HINSTANCE hinst);
  47.   ~CApp();
  48.  
  49.   // *** IUnknown methods ***
  50.   STDMETHOD(QueryInterface)(REFIID riid, void** ppvObj);
  51.   STDMETHOD_(ULONG, AddRef)(void);
  52.   STDMETHOD_(ULONG, Release)(void);
  53.   inline IUnknown  *GetUnknown(void)  {return (ISpruuidsApp *)this;};
  54.   inline IDispatch *GetDispatch(void) {return (ISpruuidsApp *)this;};
  55.  
  56.   // *** IDispatch methods ***
  57.   DECLARE_STANDARD_DISPATCH();
  58.   // Overrides required by COleAuto:
  59.   virtual ITypeInfo **GetTinfoClsAddr(void) { return &m_ptinfoCls; };
  60.   virtual ITypeInfo **GetTinfoIntAddr(void) { return &m_ptinfoInt; };
  61.   virtual HRESULT GetTypeLibInfo(HINSTANCE *phinstOut, const GUID **pplibidOut, 
  62.                                  SHORT *pwMajLibOut, SHORT *pwMinLibOut,
  63.                                  const CLSID **ppclsidOut, const IID **ppiidOut,
  64.                                  ITypeLib ***ppptlOut);
  65.   virtual IDispatch *GetPrimary() {return this->GetDispatch(); };
  66.  
  67.   // *** SpruuidsApp methods ****
  68.   STDMETHOD(get_Application)(ISpruuidsApp** lppaReturn);
  69.   STDMETHOD(get_Parent)(ISpruuidsApp** lppaReturn);
  70.   STDMETHOD(Quit)(void);
  71.   STDMETHOD(get_Game)(IGame** lppaReturn);
  72.  
  73.   // *** IComponent methods ***
  74.   STDMETHOD_(BOOL, FPreTranslateMessage)(MSG* pMsg);
  75.   STDMETHOD_(void, OnEnterState)(ULONG uStateID, BOOL fEnter);
  76.   STDMETHOD_(void, OnAppActivate)(BOOL fActive, DWORD dwOtherThreadID);
  77.   STDMETHOD_(void, OnLoseActivation)(void);
  78.   STDMETHOD_(BOOL, FDoIdle)(DWORD grfidlef);
  79.   STDMETHOD_(BOOL, FContinueMessageLoop)(ULONG uReason, void* pvLoopData);
  80.   STDMETHOD_(BOOL, FQueryTerminate)(BOOL fPromptUser);
  81.   STDMETHOD_(void, Terminate)(void);
  82.  
  83.   // *** Public methods ***
  84.   HRESULT MainMsgLoop(void);
  85.   HRESULT LoadGame(void);
  86.   void    CloseGame(void);
  87.   void    CausePause(int p);
  88.   HRESULT CheckTypeInfo(UINT itinfo);
  89.   HRESULT Playback(void);
  90.  
  91.   // *** Public member variables ***
  92.   class CMsgLoop *m_pmsgloop;
  93.   class CGame    *m_pgame;
  94.   HWND       m_hwndDlg;
  95.   HWND       m_hwndPS;
  96.   HWND       m_hwndStat;
  97.   HWND       m_hwndAbout;
  98.   HINSTANCE  m_hinst;
  99.   DWORD      m_idcomp;
  100.   BOOL       m_fRegisteredComp;
  101.   ULONG      m_cmodal;
  102.   BOOL       m_fQuit;
  103.   ULONG      m_cref;
  104.   ITypeInfo *m_ptinfoCls;   // This OLE Automation object's coclass   TypeInfo
  105.   ITypeInfo *m_ptinfoInt;   // This OLE Automation object's interface TypeInfo
  106.  
  107.   // DEBUG info
  108.   static HRESULT s_hr;
  109.   #define SIG_App 'App '
  110.   DECLARE_SIGNATURE(SIG_App);
  111.   };
  112.  
  113. //--- EOF -------------------------------------------------------------------
  114.