SettingPrtDlg.cpp
上传用户:asikq0571
上传日期:2014-07-12
资源大小:528k
文件大小:4k
源码类别:
Internet/IE编程
开发平台:
Visual C++
- // SettingPrtDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "Peugeot.h"
- #include "SettingPrtDlg.h"
- #include "MainFrm.h"
- #include "PeugeotDoc.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CSettingPrtDlg dialog
- CSettingPrtDlg::CSettingPrtDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CSettingPrtDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CSettingPrtDlg)
- m_PrtType = -1;
- m_ModbusAddr = 0;
- m_ModbusYCSize = 0;
- m_ModbusYCFunc = 0;
- m_ModbusCallInt = 0;
- m_ModbusYXFunc = 0;
- m_YCAddr = 0;
- m_YCNum = 0;
- m_YMAddr = 0;
- m_YMNum = 0;
- m_YXAddr = 0;
- m_YXNum = 0;
- m_IEC101Addr = 0;
- m_IEC101CauseLen = 0;
- m_IEC101ASDULen = 0;
- m_IEC101MsgLen = 0;
- //}}AFX_DATA_INIT
- }
- void CSettingPrtDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CSettingPrtDlg)
- DDX_Radio(pDX, IDC_PRTTYPE, m_PrtType);
- DDX_Text(pDX, IDC_MBS_ADDR, m_ModbusAddr);
- DDV_MinMaxInt(pDX, m_ModbusAddr, 0, 255);
- DDX_Text(pDX, IDC_MBS_YCSIZE, m_ModbusYCSize);
- DDV_MinMaxInt(pDX, m_ModbusYCSize, 1, 9);
- DDX_Text(pDX, IDC_MBS_YCFUNC, m_ModbusYCFunc);
- DDV_MinMaxInt(pDX, m_ModbusYCFunc, 1, 255);
- DDX_Text(pDX, IDC_MBS_CallInt, m_ModbusCallInt);
- DDV_MinMaxInt(pDX, m_ModbusCallInt, 0, 65535);
- DDX_Text(pDX, IDC_MBS_YXFUNC, m_ModbusYXFunc);
- DDV_MinMaxInt(pDX, m_ModbusYXFunc, 1, 255);
- DDX_Text(pDX, IDC_YCADDR, m_YCAddr);
- DDV_MinMaxInt(pDX, m_YCAddr, 0, 65535);
- DDX_Text(pDX, IDC_YCNUM, m_YCNum);
- DDV_MinMaxInt(pDX, m_YCNum, 0, 1024);
- DDX_Text(pDX, IDC_YMADDR, m_YMAddr);
- DDV_MinMaxInt(pDX, m_YMAddr, 0, 65535);
- DDX_Text(pDX, IDC_YMNUM, m_YMNum);
- DDV_MinMaxInt(pDX, m_YMNum, 0, 1024);
- DDX_Text(pDX, IDC_YXADDR, m_YXAddr);
- DDV_MinMaxInt(pDX, m_YXAddr, 0, 65535);
- DDX_Text(pDX, IDC_YXNUM, m_YXNum);
- DDV_MinMaxInt(pDX, m_YXNum, 0, 1024);
- DDX_Text(pDX, IDC_101_ADDR, m_IEC101Addr);
- DDV_MinMaxInt(pDX, m_IEC101Addr, 1, 255);
- DDX_Text(pDX, IDC_101_CAUSELEN, m_IEC101CauseLen);
- DDV_MinMaxInt(pDX, m_IEC101CauseLen, 1, 2);
- DDX_Text(pDX, IDC_101_ASDUADDRLEN, m_IEC101ASDULen);
- DDV_MinMaxInt(pDX, m_IEC101ASDULen, 1, 2);
- DDX_Text(pDX, IDC_101_MSGADDRLEN, m_IEC101MsgLen);
- DDV_MinMaxInt(pDX, m_IEC101MsgLen, 1, 3);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CSettingPrtDlg, CDialog)
- //{{AFX_MSG_MAP(CSettingPrtDlg)
- ON_BN_CLICKED(IDC_CMMPORT, OnCmmPort)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CSettingPrtDlg message handlers
- BOOL CSettingPrtDlg::OnInitDialog()
- {
- CMainFrame* pMainFrame;
- pMainFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd; //框架窗口指针
- CPeugeotDoc* pDoc;
- pDoc = (CPeugeotDoc*) pMainFrame->GetActiveDocument(); //文档指针
- if (pDoc->m_PrtType == pDoc->Blank)
- m_PrtType = pDoc->IEC101_S;
- else
- m_PrtType = pDoc->m_PrtType; //通讯规约
- //信息量地址,数量
- m_YXAddr = pDoc->m_YXAddr;
- m_YCAddr = pDoc->m_YCAddr;
- m_YMAddr = pDoc->m_YMAddr;
- m_YXNum = pDoc->m_YXNum;
- m_YCNum = pDoc->m_YCNum;
- m_YMNum = pDoc->m_YMNum;
- //MODBUS规约参数
- m_ModbusAddr = pDoc->m_PrtModbus.m_Addr;
- m_ModbusCallInt = pDoc->m_PrtModbus.m_CallIntv;
- m_ModbusYXFunc = pDoc->m_PrtModbus.m_YXFunc;
- m_ModbusYCFunc = pDoc->m_PrtModbus.m_YCFunc;
- m_ModbusYCSize = pDoc->m_PrtModbus.m_YCSize;
- //IEC101规约参数
- m_IEC101Addr = pDoc->m_PrtIEC101.m_Addr;
- m_IEC101CauseLen = pDoc->m_PrtIEC101.m_CauseOfTranLen;
- m_IEC101ASDULen = pDoc->m_PrtIEC101.m_CommAddrLen;
- m_IEC101MsgLen = pDoc->m_PrtIEC101.m_MsgAddrLen;
- CDialog::OnInitDialog();
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CSettingPrtDlg::OnCmmPort()
- {
- CMainFrame* pMainFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd; //框架窗口指针
- pMainFrame->SetCmmPort();
- }