home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / MSGTRACE.ZIP / MyProjects / MsgTrace / MsgTracer / MsgTracerThread.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-05-30  |  3.0 KB  |  104 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // File        : MsgTracerThread.h
  4. // Project     : MsgTrace
  5. // Component   : MsgTracer
  6. //---------------------------------------------------------------------------
  7. // Description : thread that does the monitoring
  8. //
  9. /////////////////////////////////////////////////////////////////////////////
  10. //
  11. // SourceSafe Strings. Do not change.
  12. //---------------------------------------------------------------------------
  13. // $Author: jeskes $
  14. // $Date: $
  15. // $Revision: $
  16. //
  17. /////////////////////////////////////////////////////////////////////////////
  18.  
  19. #ifndef MSGTRACERTHREAD_H
  20. #define MSGTRACERTHREAD_H
  21.  
  22. /////////////////////////////////////////////////////////////////////////////
  23.  
  24. class CMsgTracerProcess;
  25.  
  26. /////////////////////////////////////////////////////////////////////////////
  27.  
  28. class CMsgTracerThread : public CObject
  29. {
  30. //---------------------------------------------------------------------------
  31. // construction
  32. //---------------------------------------------------------------------------
  33. public:
  34.     CMsgTracerThread();
  35.     virtual ~CMsgTracerThread();
  36.  
  37. //---------------------------------------------------------------------------
  38. // thread proc
  39. //---------------------------------------------------------------------------
  40. protected:
  41.     HANDLE m_hStopEvent;
  42.     HANDLE m_hEndedEvent;
  43.  
  44.     CWinThread* m_pWinThread;
  45.  
  46.     static UINT ThreadStub( CMsgTracerThread* pThis );
  47.     UINT ThreadProc();
  48.  
  49. public:
  50.     void Run();
  51.     void Stop();
  52.  
  53.     BOOL IsRunning( DWORD dwTimeout = 0 );
  54.  
  55.     void Suspend();
  56.     void Resume();
  57.  
  58. //---------------------------------------------------------------------------
  59. // flags for debug event processing
  60. //---------------------------------------------------------------------------
  61. public:
  62.     BOOL m_bWantOutputDebugStringEvents;
  63.  
  64. //---------------------------------------------------------------------------
  65. // attach a running process
  66. //---------------------------------------------------------------------------
  67. protected:
  68.     HANDLE m_hAttachEvent;
  69.     HANDLE m_hAttachedEvent;
  70.     HANDLE m_hAttachMutex;
  71.  
  72.     CMsgTracerProcess* m_pProcessToAttach;
  73.  
  74.     class SAttachStruct : public CObject
  75.     {
  76.     public:
  77.         CMsgTracerThread* m_pThis;
  78.         CMsgTracerProcess* m_pProcessToAttach;
  79.     };
  80.  
  81.     static UINT AttachStub( SAttachStruct* pAttachStruct );
  82.     UINT AttachProc( CMsgTracerProcess* pProcessToAttach );
  83.  
  84. public:
  85.     void AttachProcess( CMsgTracerProcess* pProcess, BOOL bWait = FALSE );
  86.  
  87. //---------------------------------------------------------------------------
  88. // working
  89. //---------------------------------------------------------------------------
  90. protected:
  91.     DEBUG_EVENT m_de;
  92.     CCriticalSection m_csDispatch;
  93.  
  94.     void DispatchDebugEvent();
  95.  
  96.     void OnCreateProcessDebugEvent();
  97.     void OnExitProcessDebugEvent();
  98.     void OnOutputDebugStringEvent();
  99.     DWORD OnExceptionDebugEvent();
  100. };
  101.  
  102. /////////////////////////////////////////////////////////////////////////////
  103. #endif
  104.