| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 861 人关注过本帖
标题:有段代码,不太明白做什么用的,请指点
只看楼主 加入收藏
pla0007
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2009-10-15
结帖率:0
收藏
已结贴  问题点数:0 回复次数:5 
有段代码,不太明白做什么用的,请指点
/**************************************************************************/
/* File Name:   RunHoldStop.cpp                                           */
/* Purpose:     Test Control window with the Run/Hold/Stop buttons        */
/**************************************************************************/

//***** pseudo program include files *****
#include "stdafx.h"
#include "Pseudo2.h"
#include "RunHoldStop.h"
#include "RampCmd.h"
#include "externals.h"
#include "ft_externals.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


//***** external functions *****
extern void ExitPseudo(void);


/////////////////////////////////////////////////////////////////////////////
// RunHoldStop dialog


/*-----------------------------------------*/
RunHoldStop::RunHoldStop(CWnd* pParent /*=NULL*/)
    : CDialog(RunHoldStop::IDD, pParent)
{
    //{{AFX_DATA_INIT(RunHoldStop)
    m_Status = _T("");
    //}}AFX_DATA_INIT
}


/*-----------------------------------------*/
void RunHoldStop::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(RunHoldStop)
    DDX_Text(pDX, IDC_STATUS, m_Status);
    DDV_MaxChars(pDX, m_Status, 200);
    //}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(RunHoldStop, CDialog)
    //{{AFX_MSG_MAP(RunHoldStop)
    ON_BN_CLICKED(IDC_RUN, OnRun)
    ON_BN_CLICKED(IDC_HOLD, OnHold)
    ON_BN_CLICKED(IDC_STOP, OnStop)
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// RunHoldStop message handlers


/*-----------------------------------------*/
BOOL RunHoldStop::OnInitDialog()
{
    CDialog::OnInitDialog();
   
   SetStatus("Press RUN to start the test");
   return FALSE;

}

/*-----------------------------------------*/
void RunHoldStop::OnRun()
{
   if(Simulation)
   {
      if(execStatus == testHolding || execStatus == testInterrupted || execStatus == testNotStarted)
      {
         SetStatus("Running...");
         execStatus = testRunning;   //set execution status to running
      }
   }
   else
      runTest();

}

/*-----------------------------------------*/
void RunHoldStop::OnHold()
{
   if(Simulation)
   {
      if(execStatus == testRunning)
      {
         SetStatus("Holding...");
         execStatus = testHolding;   //set execution status to holding
      }
   }
   else
      holdTest();
   
}

/*-----------------------------------------*/
void RunHoldStop::OnStop()
{
   if(Simulation)
   {
      if (execStatus == testRunning || execStatus == testHolding)   //stop pressed for 1st time
      {
         SetStatus("Test Interrupted! STOP to exit or RUN to resume.");
         execStatus = testInterrupted;    //set execution status to interrupted
      }
      else if (execStatus == testInterrupted || execStatus == testCompleted)
      {
         SetStatus("Closing Pseudodynamic Test Program.");
         ExitPseudo();
      }
      else if(execStatus == testNotStarted)   //stop pressed before test even started
      {
         SetStatus("Test Interrupted! STOP to exit or RUN to resume.");
         execStatus = testInterrupted;    //set execution status to interrupted
      }
   }
   else
      stopTest();
   
}

/*-----------------------------------------*/
boolean RunHoldStop::rampDone(void)
{
   endOfRamp = TRUE;
   return TRUE;
}


/*-----------------------------------------*/
boolean RunHoldStop::interlock(void)
{
   testInterlock();
   return TRUE;
}


/*-----------------------------------------*/
void RunHoldStop::SetStatus(const char *msg)
{
   m_Status.Format("%s", msg);
   SetDlgItemText(IDC_STATUS, m_Status);
}

/*-----------------------------------------*/
void RunHoldStop::enableRunHold(BOOL State)
{
   GetDlgItem(IDC_STOP)->SetFocus();
   GetDlgItem(IDC_RUN)->EnableWindow(State);
   GetDlgItem(IDC_HOLD)->EnableWindow(State);
}

/*-----------------------------------------*/
void RunHoldStop::enableStop(BOOL State)
{
   GetDlgItem(IDC_STOP)->EnableWindow(State);
}


/*-----------------------------------------*/
BOOL RunHoldStop::OnCommand(WPARAM wParam, LPARAM lParam)
{

   if(LOWORD(wParam) == 0x02)        //escape key pressed, ignore it
      return TRUE;

    return CDialog::OnCommand(wParam, lParam);
}

搜索更多相关主题的帖子: 代码 
2009-10-15 09:52
calm2599
Rank: 2
等 级:论坛游民
威 望:1
帖 子:6
专家分:50
注 册:2009-10-15
收藏
得分:10 
你应该把整个工程上传来
2009-10-16 17:16
lsrwan
Rank: 2
等 级:论坛游民
帖 子:31
专家分:17
注 册:2009-10-11
收藏
得分:10 
哪段代码你不明白呢?
2009-10-17 07:33
LOVE110
Rank: 1
等 级:新手上路
帖 子:61
专家分:0
注 册:2008-11-21
收藏
得分:0 
这个代码就牛X了啊
2009-11-19 16:39
cuihaoyun
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2009-11-10
收藏
得分:0 
白跑一趟
2009-12-01 23:57
haizeng
Rank: 2
来 自:xdpsj.com
等 级:等待验证会员
帖 子:61
专家分:36
注 册:2009-11-30
收藏
得分:0 
恩 楼下的知道不?

[url=http://www./]石料生产线[/url]
[url=http://www.]破碎机[/url]
2009-12-02 08:58
快速回复:有段代码,不太明白做什么用的,请指点
数据加载中...
 
   



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

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