home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / activexcontrol / basectl / todosvr / todoctl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-10-05  |  4.1 KB  |  126 lines

  1. //=--------------------------------------------------------------------------=
  2. // ToDoCtl.H
  3. //=--------------------------------------------------------------------------=
  4. // Copyright 1995-1997 Microsoft Corporation.  All Rights Reserved.
  5. //
  6. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 
  7. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 
  8. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 
  9. // PARTICULAR PURPOSE.
  10. //=--------------------------------------------------------------------------=
  11. //
  12. // class declaration for the ToDo control.
  13. //
  14. #ifndef _TODOCTL_H_
  15.  
  16. #include "IPServer.H"
  17.  
  18. // DOCOBJ: include CDocObj.H for DocObjects instead of CCtrlObj.
  19. #include "CDocObj.H"                
  20.  
  21. #include "ToDoSvrIfc.H"
  22. #include "Dispids.H"
  23.  
  24. typedef struct tagTODOCTLSTATE {
  25.  
  26.     // TODO: put state variables here, and probably get rid of fGarbage, unless
  27.     // you have a real need for it
  28.     //
  29.     VARIANT_BOOL fGarbage;
  30.  
  31. } TODOCTLSTATE;
  32.  
  33. //=--------------------------------------------------------------------------=
  34. // CToDoControl
  35. //=--------------------------------------------------------------------------=
  36. // our control.
  37. //
  38. // DOCOBJ: use CDocumentObject as the base class instead of COleControl or 
  39. //         CInternetControl
  40. //
  41. class CToDoControl : public CDocumentObject, public IToDo, public ISupportErrorInfo {
  42.  
  43.   public:
  44.     // IUnknown methods
  45.     //
  46.     DECLARE_STANDARD_UNKNOWN();
  47.  
  48.     // IDispatch methods
  49.     //
  50.     DECLARE_STANDARD_DISPATCH();
  51.  
  52.     // ISupportErrorInfo methods
  53.     //
  54.     DECLARE_STANDARD_SUPPORTERRORINFO();
  55.  
  56.     // IToDo methods
  57.     //
  58.     // TODO: copy over the method declarations from ToDoInterfaces.H
  59.     //       don't forget to remove the PURE from them.
  60.     //
  61.     STDMETHOD_(void, AboutBox)(THIS);
  62.  
  63.     // OLE Control stuff follows:
  64.     //
  65.     CToDoControl(IUnknown *pUnkOuter);
  66.     virtual ~CToDoControl();
  67.  
  68.     // static creation function.  all controls must have one of these!
  69.     //
  70.     static IUnknown *Create(IUnknown *);
  71.  
  72.   private:
  73.     // overridables that the control must implement.
  74.     //
  75.     STDMETHOD(LoadBinaryState)(IStream *pStream);
  76.     STDMETHOD(SaveBinaryState)(IStream *pStream);
  77.     STDMETHOD(LoadTextState)(IPropertyBag *pPropertyBag, IErrorLog *pErrorLog);
  78.     STDMETHOD(SaveTextState)(IPropertyBag *pPropertyBag, BOOL fWriteDefault);
  79.     STDMETHOD(OnDraw)(DWORD dvAspect, HDC hdcDraw, LPCRECTL prcBounds, LPCRECTL prcWBounds, HDC hicTargetDev, BOOL fOptimize);
  80.     virtual LRESULT WindowProc(UINT msg, WPARAM wParam, LPARAM lParam);
  81.     virtual BOOL    RegisterClassData(void);
  82.  
  83.     virtual HRESULT InternalQueryInterface(REFIID, void **);
  84.     virtual BOOL    BeforeCreateWindow(DWORD *pdwWindowStyle, DWORD *pdwExWindowStyle, LPSTR pszWindowTitle);
  85.  
  86.     // private state information.
  87.     //
  88.     TODOCTLSTATE m_state;
  89. };
  90.  
  91.  
  92. // TODO: if you have an array of verbs, then add an extern here with the name
  93. //       of it, so that you can include it in the DEFINE_DOCOBJECT.
  94. //       ie.  extern VERBINFO m_ToDoCustomVerbs [];
  95. //
  96. extern const GUID    *rgToDoPropPages [];
  97.  
  98. // DOCOBJ: Use DEFINE_DOCOBJECT macro instead of DEFIND_CONTROL macro to 
  99. //         set up information about the DocObject. The last 4 items are 
  100. //         specific to DocObjects.
  101. //
  102. DEFINE_DOCOBJECT(ToDo,
  103.     &CLSID_ToDo,
  104.     "ToDoCtl",
  105.     CToDoControl::Create,
  106.     1,
  107.     &IID_IToDo,
  108.     "ToDo.HLP",
  109.     &DIID_DToDoEvents,
  110.     OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|OLEMISC_RECOMPOSEONRESIZE|OLEMISC_CANTLINKINSIDE|OLEMISC_INSIDEOUT,
  111.     0,
  112.     RESID_TOOLBOX_BITMAP,
  113.     "ToDoWndClass",
  114.     1,
  115.     rgToDoPropPages,
  116.     0,
  117.     NULL,
  118.     DOCMISC_CANTOPENEDIT|DOCMISC_NOFILESUPPORT,     // dwDocMiscStatus
  119.     FALSE,                                          // no IPrint support
  120.     IDS_DEFAULTEXT,                                 // resource ID of default file extension
  121.     IDS_FILEDESCRIPTION,                            // resource ID of file description
  122.     );
  123.  
  124. #define _TODOCTL_H_
  125. #endif // _TODOCTL_H_
  126.