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

  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2.  
  3. Copyright (c) 1998 Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     appsink.h
  8.  
  9. Abstract:
  10.  
  11.     SR App sample application message sink declarations.  A CFormEventSink 
  12.     that will be attached to all the forms we create in our application, 
  13.     and a CAppMessageSink that will be attached to the forms manager.
  14.  
  15. Environment:
  16.  
  17.     AutoPC
  18.  
  19. -------------------------------------------------------------------*/
  20.  
  21. #ifndef APPSINK_H
  22. #define APPSINK_H
  23.  
  24. class CFormEventSink : public IASEventSink {
  25.     public:
  26.         // Constructor and Destructor
  27.         CFormEventSink(DWORD AppThreadID);
  28.         ~CFormEventSink() {};
  29.  
  30.         //IUnknown members.
  31.         STDMETHODIMP QueryInterface(REFIID riid, PVOID *ppv);
  32.         STDMETHODIMP_(ULONG) AddRef( VOID );
  33.         STDMETHODIMP_(ULONG) Release( VOID );
  34.  
  35.         //IASEventSink members.
  36.         STDMETHODIMP ReceiveMsg( LONG uMsg, LONG wParam, LONG lParam );
  37.  
  38.         // IDispatch methods (token implementation)
  39.         STDMETHODIMP GetTypeInfoCount(UINT *pctInfo)
  40.             {return E_NOTIMPL;}
  41.         STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
  42.             {return E_NOTIMPL;}
  43.         STDMETHODIMP GetIDsOfNames(REFIID riid,    OLECHAR **rgszNames, UINT cNames, LCID    lcid, DISPID *rgdispids)
  44.             {return E_NOTIMPL;}
  45.         STDMETHODIMP Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, 
  46.             DISPPARAMS *pdispparams, VARIANT *pVarResult, EXCEPINFO *pei, UINT *puArgErr)
  47.             {return E_NOTIMPL;}
  48.  
  49.     protected:
  50.         LONG    m_cRef; // this object's ref count
  51.         DWORD   m_AppThreadId;  //Controlling app's thread ID.
  52. };
  53.  
  54. class CAppMessageSink : public IASClassMsgSink, public IASEventSink
  55. {
  56.     public:
  57.         // Constructor and Destructor
  58.         CAppMessageSink(DWORD AppThreadID);
  59.         ~CAppMessageSink() {};
  60.  
  61.         // IUnknown methods
  62.         STDMETHODIMP QueryInterface(REFIID riid, PVOID *ppv);
  63.         STDMETHODIMP_(ULONG) AddRef( VOID );
  64.         STDMETHODIMP_(ULONG) Release( VOID );
  65.  
  66.         // IASClassMsgSink methods
  67.         // Handle message is the only one we hook into
  68.         STDMETHODIMP HandleMessage(IDispatch* pdispControl, LONG uMsg, LONG wParam, LONG lParam);
  69.         STDMETHODIMP HandleStart(IDispatch* pdispControl)
  70.             {return S_FALSE;}
  71.         STDMETHODIMP HandleClose(IDispatch* pdispControl)
  72.             {return S_FALSE;}
  73.         STDMETHODIMP HandleDraw(IDispatch* pdispControl, OLE_HANDLE hDC)
  74.             {return S_FALSE;}
  75.         STDMETHODIMP HandleKeyPress(IDispatch* pdispControl, LONG lKeyPress)
  76.             {return S_FALSE;}
  77.         STDMETHODIMP HandleGotFocus(IDispatch* pdispControl)
  78.             {return S_FALSE;}
  79.         STDMETHODIMP HandleLostFocus(IDispatch* pdispControl)
  80.             {return S_FALSE;}
  81.  
  82.         // IDispatch methods (token implementation)
  83.         STDMETHODIMP GetTypeInfoCount(UINT *pctInfo)
  84.             {return E_NOTIMPL;}
  85.         STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
  86.             {return E_NOTIMPL;}
  87.         STDMETHODIMP GetIDsOfNames(REFIID riid,    OLECHAR **rgszNames, UINT cNames, LCID    lcid, DISPID *rgdispids)
  88.             {return E_NOTIMPL;}
  89.         STDMETHODIMP Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, 
  90.             DISPPARAMS *pdispparams, VARIANT *pVarResult, EXCEPINFO *pei, UINT *puArgErr)
  91.             {return E_NOTIMPL;}
  92.  
  93.         //IASEventSink member. We don't handle any messages though
  94.         STDMETHODIMP ReceiveMsg(long uMsg, long wParam, long lPararm )
  95.             {return NOERROR;}
  96.  
  97.     protected:
  98.         LONG    m_cRef; // this object's ref count
  99.         DWORD   m_AppThreadId;  //Controlling app's thread ID.
  100. };
  101.  
  102. #endif
  103.