GroupStatusDlg.cpp
上传用户:fuyouda
上传日期:2015-08-19
资源大小:6876k
文件大小:2k
源码类别:

家庭/个人应用

开发平台:

Visual C++

  1. // GroupStatusDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "DAC_VCDEMO.h"
  5. #include "GroupStatusDlg.h"
  6. #include "DACLTSDK.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // GroupStatusDlg dialog
  14. GroupStatusDlg::GroupStatusDlg(CWnd* pParent /*=NULL*/)
  15. : CDialog(GroupStatusDlg::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(GroupStatusDlg)
  18. // NOTE: the ClassWizard will add member initialization here
  19. //}}AFX_DATA_INIT
  20. }
  21. void GroupStatusDlg::DoDataExchange(CDataExchange* pDX)
  22. {
  23. CDialog::DoDataExchange(pDX);
  24. //{{AFX_DATA_MAP(GroupStatusDlg)
  25. DDX_Control(pDX, IDC_EDIT4, m_Edit4);
  26. DDX_Control(pDX, IDC_EDIT3, m_Edit3);
  27. DDX_Control(pDX, IDC_EDIT2, m_Edit2);
  28. DDX_Control(pDX, IDC_EDIT1, m_Edit1);
  29. DDX_Control(pDX, IDC_CHECK, m_Check);
  30. //}}AFX_DATA_MAP
  31. }
  32. BEGIN_MESSAGE_MAP(GroupStatusDlg, CDialog)
  33. //{{AFX_MSG_MAP(GroupStatusDlg)
  34. ON_WM_SHOWWINDOW()
  35. //}}AFX_MSG_MAP
  36. END_MESSAGE_MAP()
  37. /////////////////////////////////////////////////////////////////////////////
  38. // GroupStatusDlg message handlers
  39. void GroupStatusDlg::OnShowWindow(BOOL bShow, UINT nStatus) 
  40. {
  41. CDialog::OnShowWindow(bShow, nStatus);
  42. Refresh();
  43. }
  44. void GroupStatusDlg::Refresh()
  45. {
  46. DWORD UpdateRate, TimeBias, LCID;
  47. BOOL Active;
  48. float DeadBand;
  49. if(ASDAC_GetGroupStat(ServerHandle, GroupHandle, &UpdateRate, &Active, &TimeBias, &DeadBand, &LCID))
  50. {
  51. CString strText;
  52. strText.Format(TEXT("%f"),DeadBand);
  53. m_Edit1.SetWindowText(GroupName);
  54. m_Edit2.SetWindowText(IntToString(UpdateRate));
  55. m_Edit3.SetWindowText(strText);
  56. m_Edit4.SetWindowText(IntToString(TimeBias));
  57. if(Active)
  58. m_Check.SetCheck(1);
  59. else
  60. m_Check.SetCheck(0);
  61. }
  62. }
  63. void GroupStatusDlg::OnOK() 
  64. {
  65. CString strText;
  66. m_Edit1.GetWindowText(GroupName);
  67. m_Edit2.GetWindowText(strText);
  68. TimeBias=atoi(strText);
  69. m_Edit3.GetWindowText(strText);
  70. UpdateRate=atoi(strText);
  71. m_Edit4.GetWindowText(strText);
  72. DeadBand= float(atof(strText));
  73. if(m_Check.GetCheck()==0)
  74. Active=false;
  75. else
  76. Active=true;
  77. CDialog::OnOK();
  78. }