home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / inole2 / chap06 / ekoala4 / ekoala4.h < prev    next >
C/C++ Source or Header  |  1995-05-03  |  2KB  |  82 lines

  1. /*
  2.  * EKOALA4.H
  3.  * Koala Object EXE Server with Custom Interface Chapter 6
  4.  *
  5.  * Definitions, classes, and prototypes for an application that
  6.  * provides Koala objects to any other object user.
  7.  *
  8.  * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  9.  *
  10.  * Kraig Brockschmidt, Microsoft
  11.  * Internet  :  kraigb@microsoft.com
  12.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  13.  */
  14.  
  15.  
  16. #ifndef _EKOALA4_H_
  17. #define _EKOALA4_H_
  18.  
  19.  
  20. //Get the object definitions
  21. #include "koala.h"
  22.  
  23.  
  24. //EKOALA4.CPP
  25. LRESULT APIENTRY KoalaWndProc(HWND, UINT, WPARAM, LPARAM);
  26.  
  27. class CApp
  28.     {
  29.     friend LRESULT APIENTRY KoalaWndProc(HWND, UINT, WPARAM, LPARAM);
  30.  
  31.     protected:
  32.         HINSTANCE       m_hInst;            //WinMain parameters
  33.         HINSTANCE       m_hInstPrev;
  34.         LPSTR           m_pszCmdLine;
  35.         UINT            m_nCmdShow;
  36.  
  37.         HWND            m_hWnd;             //Main window handle
  38.  
  39.         BOOL            m_fInitialized;     //Did CoInitialize work?
  40.         LPCLASSFACTORY  m_pIClassFactory;   //Our class factory
  41.         DWORD           m_dwRegCO;          //Registration key
  42.  
  43.     public:
  44.         CApp(HINSTANCE, HINSTANCE, LPSTR, UINT);
  45.         ~CApp(void);
  46.         BOOL Init(void);
  47.     };
  48.  
  49. typedef CApp *PAPP;
  50.  
  51. #define CBWNDEXTRA              sizeof(PAPP)
  52. #define KOALAWL_STRUCTURE       0
  53.  
  54.  
  55. void ObjectDestroyed(void);
  56.  
  57.  
  58. //This class factory object creates Koala objects.
  59.  
  60. class CKoalaClassFactory : public IClassFactory
  61.     {
  62.     protected:
  63.         ULONG           m_cRef;
  64.  
  65.     public:
  66.         CKoalaClassFactory(void);
  67.         ~CKoalaClassFactory(void);
  68.  
  69.         //IUnknown members
  70.         STDMETHODIMP QueryInterface(REFIID, PPVOID);
  71.         STDMETHODIMP_(ULONG) AddRef(void);
  72.         STDMETHODIMP_(ULONG) Release(void);
  73.  
  74.         //IClassFactory members
  75.         STDMETHODIMP CreateInstance(LPUNKNOWN, REFIID, PPVOID);
  76.         STDMETHODIMP LockServer(BOOL);
  77.     };
  78.  
  79. typedef CKoalaClassFactory *PCKoalaClassFactory;
  80.  
  81. #endif //_EKOALA4_H_
  82.