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 / chap02 / reuse / reuse.h < prev    next >
C/C++ Source or Header  |  1995-05-03  |  2KB  |  79 lines

  1. /*
  2.  * REUSE.H
  3.  * COM Reusability Demo, Chapter 2
  4.  *
  5.  * Definitions, classes, and prototypes
  6.  *
  7.  * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  8.  *
  9.  * Kraig Brockschmidt, Microsoft
  10.  * Internet  :  kraigb@microsoft.com
  11.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  12.  */
  13.  
  14.  
  15. #ifndef _REUSE_H_
  16. #define _REUSE_H_
  17.  
  18. #define CHAPTER2
  19. #include <inole.h>
  20.  
  21. #ifndef RC_INVOKED
  22. #include "interfac.h"
  23. #endif
  24.  
  25. //Menu Resource ID and Commands
  26. #define IDR_MENU                    1
  27.  
  28.  
  29. #define IDM_CREATECONTAINMENT               100
  30. #define IDM_CREATEAGGREGATION               101
  31. #define IDM_ANIMALEAT                       102
  32. #define IDM_ANIMALSLEEP                     103
  33. #define IDM_ANIMALPROCREATE                 104
  34. #define IDM_KOALACLIMBEUCALYPTUSTREES       105
  35. #define IDM_KOALAPOUCHOPENSDOWN             106
  36. #define IDM_KOALASLEEPFORHOURSAFTEREATING   107
  37. #define IDM_RELEASE                         108
  38. #define IDM_EXIT                            109
  39.  
  40.  
  41. //Global creation functions
  42. BOOL    CreateKoalaContainment(IUnknown **);
  43. BOOL    CreateKoalaAggregation(IUnknown **);
  44. HRESULT CreateAnimal(IUnknown *, REFIID, void **);
  45.  
  46.  
  47. //REUSE.CPP
  48. LRESULT APIENTRY ReuseWndProc(HWND, UINT, WPARAM, LPARAM);
  49.  
  50. class CApp
  51.     {
  52.     friend LRESULT APIENTRY ReuseWndProc(HWND, UINT, WPARAM, LPARAM);
  53.  
  54.     protected:
  55.         HINSTANCE       m_hInst;            //WinMain parameters
  56.         HINSTANCE       m_hInstPrev;
  57.         UINT            m_nCmdShow;
  58.  
  59.         HWND            m_hWnd;             //Main window handle
  60.         IUnknown       *m_pIUnknown;        //Current object
  61.  
  62.     public:
  63.         CApp(HINSTANCE, HINSTANCE, UINT);
  64.         ~CApp(void);
  65.  
  66.         BOOL        Init(void);
  67.         BOOL        GetInterface(REFIID, void **);
  68.         void inline Message(LPTSTR);
  69.     };
  70.  
  71.  
  72. typedef CApp *PAPP;
  73.  
  74. #define CBWNDEXTRA          sizeof(PAPP)
  75. #define REUSEWL_STRUCTURE   0
  76.  
  77.  
  78. #endif //_REUSE_H_
  79.