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

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // File        : AttachDlg.cpp
  4. // Project     : MsgTrace
  5. // Component   : MsgTracer
  6. //---------------------------------------------------------------------------
  7. // Description : attach a running process dialog
  8. //
  9. /////////////////////////////////////////////////////////////////////////////
  10. //
  11. // SourceSafe Strings. Do not change.
  12. //---------------------------------------------------------------------------
  13. // $Author: jeskes $
  14. // $Date: $
  15. // $Revision: $
  16. //
  17. /////////////////////////////////////////////////////////////////////////////
  18.  
  19. #include "stdafx.h"
  20. #include "psapi.h"
  21.  
  22. #include "MsgTracerApp.h"
  23. #include "MsgTracerProcess.h"
  24. #include "AttachDlg.h"
  25.  
  26. /////////////////////////////////////////////////////////////////////////////
  27.  
  28. #ifdef _DEBUG
  29. #define new DEBUG_NEW
  30. #undef THIS_FILE
  31. static char THIS_FILE[] = __FILE__;
  32. #endif
  33.  
  34. /////////////////////////////////////////////////////////////////////////////
  35. // CAttachDlg 
  36. /////////////////////////////////////////////////////////////////////////////
  37.  
  38. BEGIN_MESSAGE_MAP(CAttachDlg, CDialog)
  39.     //{{AFX_MSG_MAP(CAttachDlg)
  40.     ON_BN_CLICKED(IDC_ATTACH, OnAttach)
  41.     ON_BN_CLICKED(IDC_REFRESH, OnRefresh)
  42.     ON_BN_CLICKED(IDC_TERMINATE, OnTerminate)
  43.     //}}AFX_MSG_MAP
  44. END_MESSAGE_MAP()
  45.  
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CAttachDlg: construction
  48. /////////////////////////////////////////////////////////////////////////////
  49.  
  50. CAttachDlg::CAttachDlg(CWnd* pParent ) : 
  51.  
  52.     CDialog( CAttachDlg::IDD, pParent ),
  53.     m_ctlAttachedList( m_ctlUnattachedList ),
  54.     m_ctlUnattachedList( m_ctlAttachedList )
  55.  
  56. {
  57.     //{{AFX_DATA_INIT(CAttachDlg)
  58.     //}}AFX_DATA_INIT
  59. }
  60.  
  61. /////////////////////////////////////////////////////////////////////////////
  62.  
  63. void CAttachDlg::DoDataExchange(CDataExchange* pDX)
  64. {
  65.     CDialog::DoDataExchange(pDX);
  66.     //{{AFX_DATA_MAP(CAttachDlg)
  67.     DDX_Control( pDX, IDC_ATTACHED_LIST, m_ctlAttachedList );
  68.     DDX_Control( pDX, IDC_UNATTACHED_LIST, m_ctlUnattachedList );
  69.     //}}AFX_DATA_MAP
  70. }
  71.  
  72. /////////////////////////////////////////////////////////////////////////////
  73.  
  74. BOOL CAttachDlg::OnInitDialog() 
  75. {
  76.     CDialog::OnInitDialog();
  77.  
  78.     OnRefresh();
  79.         
  80.     return( TRUE );
  81. }
  82.  
  83. /////////////////////////////////////////////////////////////////////////////
  84. // CAttachDlg message handlers
  85. /////////////////////////////////////////////////////////////////////////////
  86.  
  87. void CAttachDlg::OnAttach() 
  88. {
  89.     CWaitCursor wait;
  90.     if( m_ctlUnattachedList.OnAttach() )
  91.     {
  92.         OnRefresh();
  93.     }
  94. }
  95.  
  96. /////////////////////////////////////////////////////////////////////////////
  97.  
  98. void CAttachDlg::OnRefresh() 
  99. {
  100.     CWaitCursor wait;
  101.     m_ctlAttachedList.Refresh();
  102.     m_ctlUnattachedList.Refresh();
  103. }
  104.  
  105. /////////////////////////////////////////////////////////////////////////////
  106.  
  107. void CAttachDlg::OnTerminate() 
  108. {
  109.     CWaitCursor wait;
  110.     if( m_ctlAttachedList.OnTerminate() || m_ctlUnattachedList.OnTerminate() )
  111.     {
  112.         OnRefresh();
  113.     }
  114. }
  115.