标题:求高手帮忙 读下这程序写的什么意思 要详细点 很着急!!!
只看楼主
gwhlzy
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2008-5-18
 问题点数:0 回复次数:0 
求高手帮忙 读下这程序写的什么意思 要详细点 很着急!!!
// ControlDlg.cpp : 实现文件
//

#include "stdafx.h"
#include "Ini.h"
#include "House.h"
#include "Const.h"
#include "Execute.h"
#include "hothouse.h"
#include "ControlDlg.h"
#include ".\controldlg.h"

extern CHouse House[NUM_OF_ALL_HOUSES];
extern CExecute Execute;
extern int curID;

// CControlDlg 对话框

IMPLEMENT_DYNAMIC(CControlDlg, CDialog)
CControlDlg::CControlDlg(CWnd* pParent /*=NULL*/)
    : CDialog(CControlDlg::IDD, pParent)
    , m_nDrop(0)
    , m_nSulfur(0)
    , m_nDelay(0)
    , m_nRepetition(0)
    , m_nIWZYOn(0)
    , m_nIWZYOff(0)
    , m_nTNBWOn(0)
    , m_nTNBWOff(0)
    , m_nWWZYOff(0)
    , m_nWTCOff(0)
    , m_nWCCOff(0)
{
}

CControlDlg::~CControlDlg()
{
}

void CControlDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    DDX_Text(pDX, IDC_EDIT_DROP, m_nDrop);
    DDV_MinMaxInt(pDX, m_nDrop, 0, 1000);
    DDX_Text(pDX, IDC_EDIT_SULFUR, m_nSulfur);
    DDV_MinMaxInt(pDX, m_nSulfur, 0, 1000);
    DDX_Text(pDX, IDC_EDIT_DELAY, m_nDelay);
    DDV_MinMaxInt(pDX, m_nDelay, 0, 1000);
    DDX_Text(pDX, IDC_EDIT_REPETITION, m_nRepetition);
    DDV_MinMaxInt(pDX, m_nRepetition, 1, 100);
    DDX_Text(pDX, IDC_EDIT_IWZYON, m_nIWZYOn);
    DDV_MinMaxInt(pDX, m_nIWZYOn, 0, 100000);
    DDX_Text(pDX, IDC_EDIT_IWZYOFF, m_nIWZYOff);
    DDV_MinMaxInt(pDX, m_nIWZYOff, 0, 100000);
    DDX_Text(pDX, IDC_EDIT_TNBWON, m_nTNBWOn);
    DDV_MinMaxInt(pDX, m_nTNBWOn, -50, 50);
    DDX_Text(pDX, IDC_EDIT_TNBWOFF, m_nTNBWOff);
    DDV_MinMaxInt(pDX, m_nTNBWOff, -50, 50);
    DDX_Text(pDX, IDC_EDIT_WWZYOFF, m_nWWZYOff);
    DDV_MinMaxInt(pDX, m_nWWZYOff, 1, 12);
    DDX_Text(pDX, IDC_EDIT_WTCOFF, m_nWTCOff);
    DDV_MinMaxInt(pDX, m_nWTCOff, 1, 12);
    DDX_Text(pDX, IDC_EDIT_WCCOFF, m_nWCCOff);
    DDV_MinMaxInt(pDX, m_nWCCOff, 1, 12);
    DDX_Control(pDX, IDC_COMBO_RTCOFF, m_ccbRTCOff);
    DDX_Control(pDX, IDC_COMBO_RCCOFF, m_ccbRCCOff);
}


BEGIN_MESSAGE_MAP(CControlDlg, CDialog)
    ON_BN_CLICKED(IDOK, OnBnClickedOk)
END_MESSAGE_MAP()


// CControlDlg 消息处理程序

BOOL CControlDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

    m_nDrop = House[curID].m_nDropTime;
    m_nSulfur = House[curID].m_nSulfurTime;
    m_nDelay = House[curID].m_nDelay;
    m_nRepetition = House[curID].m_nRepetition;
    m_nIWZYOn = House[curID].m_nIWZYOn;
    m_nIWZYOff = House[curID].m_nIWZYOff;
    m_nTNBWOn = House[curID].m_nTNBWOn;
    m_nTNBWOff = House[curID].m_nTNBWOff;
    m_nWWZYOff = House[curID].m_nWWZYOff;
    m_nWTCOff = House[curID].m_nWTCOff;
    m_nWCCOff = House[curID].m_nWCCOff;
    m_ccbRTCOff.InsertString(0, "晴");
    m_ccbRTCOff.InsertString(1, "毛毛雨");
    m_ccbRTCOff.InsertString(2, "小雨");
    m_ccbRTCOff.InsertString(3, "中雨");
    m_ccbRTCOff.InsertString(4, "大雨");
    m_ccbRTCOff.InsertString(5, "暴雨");
    m_ccbRCCOff.InsertString(0, "晴");
    m_ccbRCCOff.InsertString(1, "毛毛雨");
    m_ccbRCCOff.InsertString(2, "小雨");
    m_ccbRCCOff.InsertString(3, "中雨");
    m_ccbRCCOff.InsertString(4, "大雨");
    m_ccbRCCOff.InsertString(5, "暴雨");
    m_ccbRTCOff.SetCurSel(House[curID].m_nRTCOff);
    m_ccbRCCOff.SetCurSel(House[curID].m_nRCCOff);
    UpdateData(FALSE);
    return TRUE;  // return TRUE unless you set the focus to a control
    // 异常: OCX 属性页应返回 FALSE
}

void CControlDlg::OnBnClickedOk()
{
    UpdateData(TRUE);
    CStdioFile File;
    CString buf;
    char pathname[1024];
    memset(pathname, 0, 1024);
    CIni Ini;
    ::GetCurrentDirectory(1024, pathname);
    strcat(pathname, HOUSE_CONF);
    buf.Format("%02d", curID);
    strcat(pathname, buf);
    strcat(pathname, ".cfg");
    Ini.SetPathName(pathname);
    Ini.WriteInt("控制", "滴灌开启时间", m_nDrop);
    Ini.WriteInt("控制", "硫磺熏蒸器开启时间", m_nSulfur);
    Ini.WriteInt("控制", "延迟时间", m_nDelay);
    Ini.WriteInt("控制", "循环次数", m_nRepetition);
    Ini.WriteInt("标准值", "开外遮阳光照", m_nIWZYOn);
    Ini.WriteInt("标准值", "关外遮阳光照", m_nIWZYOff);
    Ini.WriteInt("标准值", "开内保温温度", m_nTNBWOn);
    Ini.WriteInt("标准值", "关内保温温度", m_nTNBWOff);
    Ini.WriteInt("标准值", "关外遮阳风级", m_nWWZYOff);
    Ini.WriteInt("标准值", "关天窗风级", m_nWTCOff);
    Ini.WriteInt("标准值", "关侧窗风级", m_nWCCOff);
    Ini.WriteInt("标准值", "关天窗雨量", m_ccbRTCOff.GetCurSel());
    Ini.WriteInt("标准值", "关侧窗雨量", m_ccbRCCOff.GetCurSel());
    House[curID].m_nDropTime = m_nDrop;
    House[curID].m_nSulfurTime = m_nSulfur;
    House[curID].m_nDelay = m_nDelay;
    House[curID].m_nRepetition = m_nRepetition;
    House[curID].m_nIWZYOn = m_nIWZYOn;
    House[curID].m_nIWZYOff = m_nIWZYOff;
    House[curID].m_nTNBWOn = m_nTNBWOn;
    House[curID].m_nTNBWOff = m_nTNBWOff;
    House[curID].m_nWWZYOff = m_nWWZYOff;
    House[curID].m_nWTCOff = m_nWTCOff;
    House[curID].m_nWCCOff = m_nWCCOff;
    House[curID].m_nRTCOff = m_ccbRTCOff.GetCurSel();
    House[curID].m_nRCCOff = m_ccbRCCOff.GetCurSel();

    LPSERIALTASK pTask = new SERIALTASK;
    pTask->nFlags = EX_SET | EX_PARAMETER;
    UINT nIndex = Execute.m_pTaskArr.GetSize();
    Execute.m_pTaskArr.InsertAt(nIndex, pTask);
    OnOK();
}
搜索更多相关主题的帖子: quot include extern CControlDlg 
2008-05-21 17:14



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-215471-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.433587 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved