107 lines
3.3 KiB
C++
107 lines
3.3 KiB
C++
// DialPlcStatusShow.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "geomative.h"
|
|
#include "DialPlcStatusShow.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDialPlcStatusShow dialog
|
|
extern float tcp_ntohf(float f);
|
|
|
|
CDialPlcStatusShow::CDialPlcStatusShow(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CDialPlcStatusShow::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CDialPlcStatusShow)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
//}}AFX_DATA_INIT
|
|
m_pRemPlcData = NULL;
|
|
|
|
}
|
|
|
|
|
|
void CDialPlcStatusShow::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CDialPlcStatusShow)
|
|
// NOTE: the ClassWizard will add DDX and DDV calls here
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CDialPlcStatusShow, CDialog)
|
|
//{{AFX_MSG_MAP(CDialPlcStatusShow)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDialPlcStatusShow message handlers
|
|
extern int g_iUILanguage;
|
|
BOOL CDialPlcStatusShow::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
// TODO: Add extra initialization here
|
|
if (NULL == m_pRemPlcData)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("空数据"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Data is null"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return FALSE;
|
|
}
|
|
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
{
|
|
GetDlgItem(IDC_STATIC_BATTERYVOLTAGE)->SetWindowTextA(_T("电池电压:"));
|
|
GetDlgItem(IDC_STATIC_TEMPERATURE)->SetWindowTextA(_T("温度:"));
|
|
GetDlgItem(IDC_STATIC_GDSWITCH)->SetWindowTextA(_T("GD开关:"));
|
|
GetDlgItem(IDC_STATIC_BPSWITCH)->SetWindowTextA(_T("BP开关:"));
|
|
}
|
|
CString strTxt;
|
|
/*strTxt.Empty();
|
|
strTxt.Format("%.2f", tcp_ntohf(*((float*)(&(m_pRemPlcData->uiAnaLogQua[0])))));
|
|
GetDlgItem(IDC_EDIT_VOLTAGE1)->SetWindowText(strTxt);
|
|
|
|
strTxt.Empty();
|
|
strTxt.Format("%.2f", tcp_ntohf(*((float*)(&(m_pRemPlcData->uiAnaLogQua[1])))));
|
|
GetDlgItem(IDC_EDIT_VOLTAGE2)->SetWindowText(strTxt);
|
|
|
|
strTxt.Empty();
|
|
strTxt.Format("%.2f", tcp_ntohf(*((float*)(&(m_pRemPlcData->uiAnaLogQua[2])))));
|
|
GetDlgItem(IDC_EDIT_VOLTAGE3)->SetWindowText(strTxt);
|
|
|
|
strTxt.Empty();
|
|
strTxt.Format("%.2f", tcp_ntohf(*((float*)(&(m_pRemPlcData->uiAnaLogQua[3])))));
|
|
GetDlgItem(IDC_EDIT_VOLTAGE4)->SetWindowText(strTxt);*/
|
|
|
|
strTxt.Empty();
|
|
strTxt.Format("%.2f", tcp_ntohf(*((float*)(&(m_pRemPlcData->uiAnaLogQua[4])))));
|
|
GetDlgItem(IDC_EDIT_BATTERY_VOLTAGE)->SetWindowText(strTxt);
|
|
|
|
strTxt.Empty();
|
|
strTxt.Format("%.2f", tcp_ntohf(*((float*)(&(m_pRemPlcData->uiAnaLogQua[5])))));
|
|
GetDlgItem(IDC_EDIT_TEMPERATURE)->SetWindowText(strTxt);
|
|
|
|
|
|
|
|
//strTxt = (m_pRemPlcData->ucCtrlK1 == 0) ? "OFF" : "ON";
|
|
//GetDlgItem(IDC_EDIT_SWITCH_1)->SetWindowText(strTxt);
|
|
|
|
//strTxt = (m_pRemPlcData->ucCtrlK2 == 0) ? "OFF" : "ON";
|
|
//GetDlgItem(IDC_EDIT_SWITCH_2)->SetWindowText(strTxt);
|
|
strTxt = (m_pRemPlcData->ucCtrlK3 == 0) ? "OFF" : "ON";
|
|
GetDlgItem(IDC_EDIT_SWITCH_3)->SetWindowText(strTxt);
|
|
|
|
strTxt = (m_pRemPlcData->ucCtrlK4 == 0) ? "OFF" : "ON";
|
|
GetDlgItem(IDC_EDIT_SWITCH_4)->SetWindowText(strTxt);
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|