home *** CD-ROM | disk | FTP | other *** search
- /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
- Copyright (c) 1998 Microsoft Corporation
-
- Module Name:
-
- SimpleClock.h
-
- Abstract:
-
- CSimpleClockApp and CSimpleClockSink class definitions.
-
- Environment:
-
- AutoPC
-
- -------------------------------------------------------------------*/
-
- #ifndef SIMPLECLOCK_H
- #define SIMPLECLOCK_H
-
- //
- // App class definition
- //
-
- class CSimpleClockApp
- {
- //Methods
- public:
- CSimpleClockApp( DWORD dwThreadID);
- virtual ~CSimpleClockApp();
- void ProcessMessage(LONG uMsg, LONG wParam, LONG lParam); //Handles stray messages
- void Clean(); //Releases everything used by App
-
- private:
- BOOL CreateSinks(); //Creates a IASEventSink and IASClassMsgSink
- BOOL CreateFormsManager(); //Creates and starts the forms manager
- BOOL CreateMainForm(); //Creates main form
- BOOL AddControls(); //Adds the clock and label control
- BOOL LoadBSTR(UINT uID, BSTR * pbstrTarget); //Loads a bstr from a resource
-
- //Properties
- public:
- HINSTANCE m_hInst;
- BOOL Init();
- DWORD m_dwThreadID;
-
- private:
- BSTR m_bstrExitText; //text telling how to exit
- BSTR m_bstrAppName; //text of the app name
- OLE_HANDLE m_hFC; //Form context handle
- IASEventSink* m_pFormEventSink; //Event sink attatched to main form
- IASClassMsgSink* m_pFmMsgSink; //Message sink attatched to form manager(App)
- IfmManage* m_pManager; //Forms manager
- IASForm* m_pForm; //The one and only form
- IASLabel* m_pLabel; //Label control
- IASClock* m_pClock; //Clock control
- IASLabel* m_pClockLabel; //Label for the clock control
-
- };
-
-
- //
- // CSimpleClockSink definition - Implements IUnknown and IDispatch interfaces
- // because it is a COM object, and IASEventSink and IASClassMsgSink interfaces
- // to receive application messages.
- //
-
- class CSimpleClockSink :
- public IASEventSink,
- public IASClassMsgSink
- {
- public:
- CSimpleClockSink(DWORD dwThreadID);
- virtual ~CSimpleClockSink();
-
- //IUknown methods, must implement
- STDMETHODIMP QueryInterface(REFIID riid, PVOID *ppv);
- STDMETHODIMP_(ULONG) AddRef( VOID );
- STDMETHODIMP_(ULONG) Release( VOID );
-
- //IDispatch methods, token implementation
- STDMETHODIMP GetTypeInfoCount(UINT *pctInfo)
- {return NOERROR;}
- STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
- {return NOERROR;}
- STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR **rgszNames, UINT cNames,
- LCID lcid, DISPID *rgdispids)
- {return NOERROR;}
- STDMETHODIMP Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags,
- DISPPARAMS *pdispparams, VARIANT *pVarResult, EXCEPINFO *pei, UINT *puArgErr)
- {return NOERROR;}
-
- //IASClassMsgSink methods, token implementation except for the one we want (HandleKeyPress)
- STDMETHODIMP HandleKeyPress(IDispatch* pdispControl, LONG lKeyPress);
- STDMETHODIMP HandleMessage(IDispatch* pdispControl, LONG uMsg, LONG wParam, LONG lParam)
- {return S_FALSE;}
- STDMETHODIMP HandleStart(IDispatch* pdispControl)
- {return S_FALSE;}
- STDMETHODIMP HandleClose(IDispatch* pdispControl)
- {return S_FALSE;}
- STDMETHODIMP HandleDraw(IDispatch* pdispControl, OLE_HANDLE hDC)
- {return S_FALSE;}
- STDMETHODIMP HandleGotFocus(IDispatch* pdispControl)
- {return S_FALSE;}
- STDMETHODIMP HandleLostFocus(IDispatch* pdispControl)
- {return S_FALSE;}
-
- //IASEventSink members.
- STDMETHODIMP ReceiveMsg(LONG uMsg, LONG wParam, LONG lParam)
- {return S_FALSE;}
-
- private:
- long m_lRefCount; // this object's ref count
- DWORD m_dwThreadID;
-
- };
-
-
- #endif // SIMPLECLOCK_H
-