home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / AutoPC / apcsdk10.exe / data1.cab / Win32_Samples / win32 / Keyboard / appsink.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-13  |  4.1 KB  |  117 lines

  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2.  
  3. Copyright (c) 1998 Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     appsink.h
  8.  
  9. Abstract:
  10.  
  11.     Keyboard Sample application sink definitions.  Implements two classes, 
  12.     CFormEventSink and CAppMessageSink.
  13.  
  14. Environment:
  15.  
  16.     AutoPC
  17.  
  18. -------------------------------------------------------------------*/
  19.  
  20. #ifndef APPSINK_H
  21. #define APPSINK_H
  22.  
  23. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  24. Class:
  25.     CFormEventSink
  26.  
  27. Description:
  28.     Implements IASEventSink interface.  Doesn't handle any messages
  29.     (All of them are handled in the ClassMsgSink attached to the form
  30.     manager)
  31. -------------------------------------------------------------------*/
  32. class CFormEventSink : public IASEventSink 
  33. {
  34.     public:
  35.         // Constructor and empty destructor
  36.         CFormEventSink(DWORD);
  37.         ~CFormEventSink() {};
  38.  
  39.         //IUnknown methods
  40.         STDMETHODIMP QueryInterface(REFIID riid, PVOID *ppv);
  41.         STDMETHODIMP_(ULONG) AddRef();
  42.         STDMETHODIMP_(ULONG) Release();
  43.  
  44.         //IASEventSink methods
  45.         STDMETHODIMP ReceiveMsg( LONG uMsg, LONG wParam, LONG lParam );
  46.  
  47.         // IDispatch methods (token implementation)
  48.         STDMETHODIMP GetTypeInfoCount(UINT *pctInfo)
  49.             {return E_NOTIMPL;}
  50.         STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
  51.             {return E_NOTIMPL;}
  52.         STDMETHODIMP GetIDsOfNames(REFIID riid,    OLECHAR **rgszNames, UINT cNames, LCID    lcid, DISPID *rgdispids)
  53.             {return E_NOTIMPL;}
  54.         STDMETHODIMP Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdispparams, VARIANT *pVarResult, EXCEPINFO *pei, UINT *puArgErr)
  55.             {return E_NOTIMPL;}
  56.  
  57.     protected:
  58.         LONG    m_cRef;            // This object's ref count
  59.         DWORD   m_AppThreadId;  // Controlling app's thread ID.
  60. };
  61.  
  62. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  63. Class:
  64.     CAppMessageSink
  65.  
  66. Description:
  67.     ClassMsgSink and EventSink attached to the form Manager.
  68. -------------------------------------------------------------------*/
  69. class CAppMessageSink : public IASClassMsgSink, public IASEventSink
  70. {
  71.     public:
  72.         // Constructor and empty destructor
  73.         CAppMessageSink(DWORD);
  74.         ~CAppMessageSink() {};
  75.  
  76.         // IUnknown methods
  77.         STDMETHODIMP QueryInterface(REFIID riid, PVOID *ppv);
  78.         STDMETHODIMP_(ULONG) AddRef();
  79.         STDMETHODIMP_(ULONG) Release();
  80.  
  81.         // IASClassMsgSink methods
  82.         // HandleKeyPress and HandleMessage are the only two methods we are going
  83.         // to do anything with.
  84.         STDMETHODIMP HandleKeyPress(IDispatch* pdispControl, LONG lKeyPress);
  85.         STDMETHODIMP HandleMessage(IDispatch* pdispControl, LONG uMsg, LONG wParam, LONG lParam);
  86.         // The reset of the methods just return False to keep the message going down the pipe
  87.         STDMETHODIMP HandleStart(IDispatch* pdispControl)
  88.             {return S_FALSE;}
  89.         STDMETHODIMP HandleClose(IDispatch* pdispControl)
  90.             {return S_FALSE;}
  91.         STDMETHODIMP HandleDraw(IDispatch* pdispControl, OLE_HANDLE hDC)
  92.             {return S_FALSE;}
  93.         STDMETHODIMP HandleGotFocus(IDispatch* pdispControl)
  94.             {return S_FALSE;}
  95.         STDMETHODIMP HandleLostFocus(IDispatch* pdispControl)
  96.             {return S_FALSE;}
  97.  
  98.         // IDispatch methods (token implementation)        
  99.         STDMETHODIMP GetTypeInfoCount(UINT *pctInfo)
  100.             {return NOERROR;}
  101.         STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
  102.             {return NOERROR;}
  103.         STDMETHODIMP GetIDsOfNames(REFIID riid,    OLECHAR **rgszNames, UINT cNames, LCID    lcid, DISPID *rgdispids)
  104.             {return NOERROR;}
  105.         STDMETHODIMP Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdispparams, VARIANT *pVarResult, EXCEPINFO *pei, UINT *puArgErr)
  106.             {return NOERROR;}
  107.  
  108.         // IASEventSink methods
  109.         STDMETHODIMP ReceiveMsg( LONG uMsg, LONG wParam, LONG lParam );
  110.  
  111.     protected:
  112.         LONG    m_cRef;            // This object's ref count
  113.         DWORD   m_AppThreadId;  // Controlling app's thread ID.
  114. };
  115.  
  116. #endif    // APPSINK_H
  117.