RemoteParamReport.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. // RemoteParamReport.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "StoneU_HC_OCX.h"
  5. #include "RemoteParamReport.h"
  6. #include ".\remoteparamreport.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CRemoteParamReport dialog
  14. CRemoteParamReport::CRemoteParamReport(CWnd* pParent /*=NULL*/)
  15. : CDialog(CRemoteParamReport::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(CRemoteParamReport)
  18. // NOTE: the ClassWizard will add member initialization here
  19. //}}AFX_DATA_INIT
  20. m_SuicideTimer = WM_USER + 100;
  21. }
  22. void CRemoteParamReport::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(CRemoteParamReport)
  26. DDX_Control(pDX, IDC_REPORTLIST, m_ReportList);
  27. //}}AFX_DATA_MAP
  28. }
  29. BEGIN_MESSAGE_MAP(CRemoteParamReport, CDialog)
  30. //{{AFX_MSG_MAP(CRemoteParamReport)
  31. ON_WM_TIMER()
  32. ON_WM_CREATE()
  33. //}}AFX_MSG_MAP
  34. ON_BN_CLICKED(IDCANCEL, OnBnClickedCancel)
  35. END_MESSAGE_MAP()
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CRemoteParamReport message handlers
  38. void CRemoteParamReport::OnTimer(UINT nIDEvent)
  39. {
  40. // TODO: Add your message handler code here and/or call default
  41. if (nIDEvent == m_SuicideTimer)
  42. {
  43. OnCancel();
  44. }
  45. CDialog::OnTimer(nIDEvent);
  46. }
  47. BOOL CRemoteParamReport::OnInitDialog()
  48. {
  49. CDialog::OnInitDialog();
  50. CRect rc(0, 0, 0, 0);
  51. GetWindowRect(&rc);
  52. CRect adjust(0, 0, 0, 0);
  53. GetParent()->GetWindowRect(&adjust);
  54. ClientToScreen(&adjust);
  55. SetWindowPos(&CWnd::wndTop, adjust.left*2/3, adjust.top, rc.Width(), rc.Height(), SWP_SHOWWINDOW);
  56. // TODO: Add extra initialization here
  57. m_ReportList.SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
  58. m_ReportList.InsertColumn(0, "错误提示", LVCFMT_LEFT, 500, -1);
  59. SetTimer(m_SuicideTimer, 10000, NULL);
  60. return TRUE; // return TRUE unless you set the focus to a control
  61. // EXCEPTION: OCX Property Pages should return FALSE
  62. }
  63. void CRemoteParamReport::InsertReport(char *Report, int len)
  64. {
  65. if (IsWindow(this->GetSafeHwnd()))
  66. {
  67. memset(m_ReportBuf, 0, MAX_PATH);
  68. memcpy(m_ReportBuf, Report, len);
  69. m_ReportList.InsertItem(m_ReportList.GetItemCount(), m_ReportBuf);
  70. }
  71. }
  72. void CRemoteParamReport::OnCancel()
  73. {
  74. // TODO: Add extra cleanup here
  75. KillTimer(m_SuicideTimer);
  76. CDialog::OnCancel();
  77. DestroyWindow();
  78. }
  79. int CRemoteParamReport::OnCreate(LPCREATESTRUCT lpCreateStruct)
  80. {
  81. if (CDialog::OnCreate(lpCreateStruct) == -1)
  82. return -1;
  83. // TODO: Add your specialized creation code here
  84. return 0;
  85. }
  86. void CRemoteParamReport::OnBnClickedCancel()
  87. {
  88. // TODO: 在此添加控件通知处理程序代码
  89. OnCancel();
  90. }