Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
2.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1992.
  5. //
  6. // File: cballs.hxx
  7. //
  8. // Contents: Class to encapsulate demo of distributed binding interface
  9. //
  10. // Classes: CBall
  11. //
  12. // History: 06-Aug-92 Ricksa Created
  13. //
  14. //--------------------------------------------------------------------------
  15. #ifndef __BALLS__
  16. #define __BALLS__
  17. #include <sem.hxx>
  18. #include <otrack.hxx>
  19. #include <iballs.h>
  20. #include <ballscf.hxx>
  21. #define BALL_UNDEF 0xFFFFFFFF
  22. #define BALL_DIAMETER 10
  23. //+-------------------------------------------------------------------------
  24. //
  25. // Class: CBall
  26. //
  27. // Purpose: Class to demostrate remote binding functionality
  28. //
  29. // Interface: QueryInterface
  30. // AddRef
  31. // Release
  32. // CreateBall - create a ball
  33. // MoveBall - move a ball
  34. // GetBallPos - get the ball position (x,y)
  35. // IsOverLapped - see if other ball is overlapped with this ball
  36. // IsContainedIn - see if ball is inside given cube
  37. // Clone - make a new ball at the same position as this
  38. // Echo - returns the same interface passed in
  39. //
  40. // History: 06-Aug-92 Ricksa Created
  41. //
  42. //--------------------------------------------------------------------------
  43. class CBall : public IBalls
  44. {
  45. public:
  46. CBall(IUnknown *punkOuter);
  47. ~CBall(void);
  48. STDMETHOD(QueryInterface)(REFIID riid, void **ppunk);
  49. STDMETHOD_(ULONG, AddRef)(void);
  50. STDMETHOD_(ULONG, Release)(void);
  51. STDMETHOD(QueryInternalIface)(REFIID riid, void **ppunk);
  52. STDMETHOD(CreateBall)(ULONG xPos, ULONG yPos);
  53. STDMETHOD(MoveBall)(ULONG xPos, ULONG yPos);
  54. STDMETHOD(GetBallPos)(ULONG *xPos, ULONG *yPos);
  55. STDMETHOD(IsOverLapped)(IBalls *pIBall);
  56. STDMETHOD(IsContainedIn)(ICube *pICube);
  57. STDMETHOD(Clone)(IBalls **ppIBall);
  58. STDMETHOD(Echo)(IUnknown *punkIn, IUnknown **ppunkOut);
  59. private:
  60. ULONG _xPos;
  61. ULONG _yPos;
  62. IUnknown * _punkOuter;
  63. };
  64. //+-------------------------------------------------------------------------
  65. //
  66. // Class: CBallCtrlUnk
  67. //
  68. // Purpose: Class to demostrate remote binding functionality
  69. //
  70. // Interface: QueryInterface
  71. // AddRef
  72. // Release
  73. //
  74. // History: 06-Aug-92 Ricksa Created
  75. //
  76. //--------------------------------------------------------------------------
  77. class CBallCtrlUnk : INHERIT_TRACKING,
  78. public IUnknown
  79. {
  80. public:
  81. CBallCtrlUnk(IUnknown *punkOuter);
  82. STDMETHOD(QueryInterface)(REFIID riid, void **ppunk);
  83. DECLARE_STD_REFCOUNTING;
  84. private:
  85. ~CBallCtrlUnk(void);
  86. CBall _ball;
  87. };
  88. #endif // __BALLS__