home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / winui / shell / bandobjs / commband.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-12-11  |  3.0 KB  |  107 lines

  1. /**************************************************************************
  2.    THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  3.    ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  4.    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  5.    PARTICULAR PURPOSE.
  6.  
  7.    Copyright 1997 - 1998 Microsoft Corporation.  All Rights Reserved.
  8. **************************************************************************/
  9.  
  10. /**************************************************************************
  11.  
  12.    File:          CommBand.h
  13.    
  14.    Description:   CCommBand definitions.
  15.  
  16. **************************************************************************/
  17.  
  18. #include <windows.h>
  19. #include <shlobj.h>
  20.  
  21. #include "Globals.h"
  22.  
  23. #ifndef COMMBAND_H
  24. #define COMMBAND_H
  25.  
  26. #define CB_CLASS_NAME (TEXT("CommBandSampleClass"))
  27.  
  28. #define IDM_COMMAND  0
  29.  
  30. /**************************************************************************
  31.  
  32.    CCommBand class definition
  33.  
  34. **************************************************************************/
  35.  
  36. class CCommBand : public IDeskBand, 
  37.                   public IInputObject, 
  38.                   public IObjectWithSite,
  39.                   public IPersistStream,
  40.                   public IContextMenu
  41. {
  42. protected:
  43.    DWORD m_ObjRefCount;
  44.  
  45. public:
  46.    CCommBand();
  47.    ~CCommBand();
  48.  
  49.    //IUnknown methods
  50.    STDMETHODIMP QueryInterface(REFIID, LPVOID*);
  51.    STDMETHODIMP_(DWORD) AddRef();
  52.    STDMETHODIMP_(DWORD) Release();
  53.  
  54.    //IOleWindow methods
  55.    STDMETHOD (GetWindow) (HWND*);
  56.    STDMETHOD (ContextSensitiveHelp) (BOOL);
  57.  
  58.    //IDockingWindow methods
  59.    STDMETHOD (ShowDW) (BOOL fShow);
  60.    STDMETHOD (CloseDW) (DWORD dwReserved);
  61.    STDMETHOD (ResizeBorderDW) (LPCRECT prcBorder, IUnknown* punkToolbarSite, BOOL fReserved);
  62.  
  63.    //IDeskBand methods
  64.    STDMETHOD (GetBandInfo) (DWORD, DWORD, DESKBANDINFO*);
  65.  
  66.    //IInputObject methods
  67.    STDMETHOD (UIActivateIO) (BOOL, LPMSG);
  68.    STDMETHOD (HasFocusIO) (void);
  69.    STDMETHOD (TranslateAcceleratorIO) (LPMSG);
  70.  
  71.    //IObjectWithSite methods
  72.    STDMETHOD (SetSite) (IUnknown*);
  73.    STDMETHOD (GetSite) (REFIID, LPVOID*);
  74.  
  75.    //IPersistStream methods
  76.    STDMETHOD (GetClassID) (LPCLSID);
  77.    STDMETHOD (IsDirty) (void);
  78.    STDMETHOD (Load) (LPSTREAM);
  79.    STDMETHOD (Save) (LPSTREAM, BOOL);
  80.    STDMETHOD (GetSizeMax) (ULARGE_INTEGER*);
  81.  
  82.    //IContextMenu methods
  83.    STDMETHOD (QueryContextMenu)(HMENU, UINT, UINT, UINT, UINT);
  84.    STDMETHOD (InvokeCommand)(LPCMINVOKECOMMANDINFO);
  85.    STDMETHOD (GetCommandString)(UINT, UINT, LPUINT, LPSTR, UINT);
  86.  
  87. private:
  88.     BOOL m_bFocus;
  89.     HWND m_hwndParent;
  90.     HWND m_hWnd;
  91.     DWORD m_dwViewMode;
  92.    DWORD m_dwBandID;
  93.    IInputObjectSite *m_pSite;
  94.  
  95. private:
  96.     void FocusChange(BOOL);
  97.    LRESULT OnKillFocus(void);
  98.     LRESULT OnSetFocus(void);
  99.     static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam);
  100.     LRESULT OnPaint(void);
  101.     LRESULT OnCommand(WPARAM wParam, LPARAM lParam);
  102.    BOOL RegisterAndCreateWindow(void);
  103. };
  104.  
  105. #endif   //COMMBAND_H
  106.  
  107.