Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.7 KiB

  1. // worker.h : Declaration of the CWorkerThread
  2. #ifndef __WORKER_H_
  3. #define __WORKER_H_
  4. #include "iface.h" // for IWorkerEvent
  5. // CWorkerThread
  6. class CWorkerThread : public IARPWorker
  7. {
  8. public:
  9. CWorkerThread();
  10. virtual ~CWorkerThread();
  11. // *** IUnknown ***
  12. virtual STDMETHODIMP_(ULONG) AddRef (void);
  13. virtual STDMETHODIMP_(ULONG) Release (void);
  14. virtual STDMETHODIMP QueryInterface (REFIID riid, LPVOID * ppvObj);
  15. // *** IARPWorker ***
  16. virtual STDMETHODIMP KillWT (void);
  17. STDMETHOD(StartWT) (int iPriority);
  18. STDMETHOD(SetListenerWT) (IWorkerEvent * pwe);
  19. BOOL IsKilled() { return _fKillWorker; };
  20. BOOL PostWorkerMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
  21. virtual DWORD _ThreadStartProc();
  22. protected:
  23. DWORD _dwThreadId;
  24. private:
  25. void _LockWorker(void);
  26. void _UnlockWorker(void);
  27. LONG _cRef;
  28. CRITICAL_SECTION _csWorker;
  29. DEBUG_CODE( LONG _cRefLockWorker; )
  30. LONG _cItems;
  31. IWorkerEvent * _pwe;
  32. BITBOOL _fKillWorker: 1;
  33. HANDLE _hthreadWorker;
  34. HWND _hwndWorker;
  35. LRESULT _WorkerWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  36. static DWORD CALLBACK _ThreadStartProcWrapper(LPVOID lpParam);
  37. static LRESULT CALLBACK _WorkerWndProcWrapper(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  38. };
  39. // Window messages from worker thread that cause actions on the main thread
  40. #define WORKERWIN_FIRE_ROW_READY (WM_USER + 0x0101) // wParam is row #
  41. #define WORKERWIN_FIRE_FINISHED (WM_USER + 0X0102)
  42. #define WORKERWIN_FIRE_DATASETCHANGED (WM_USER + 0X0103)
  43. #endif //__WORKER_H_