⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 motordlgbase.cpp

📁 一个用于无刷直流电动机的驱动与控制程序.里面所用的采集卡的型号为MC08.
💻 CPP
字号:
// MotorDlgBase.cpp : implementation file
//

#include "stdafx.h"
#include "TestForm.h"
#include "MotorDlgBase.h"

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

#define totalDialog  13   //定义主控窗口中需要显示的对话框总数

/////////////////////////////////////////////////////////////////////////////
// MotorDlgBase

IMPLEMENT_DYNCREATE(MotorDlgBase, CFormView)

MotorDlgBase::MotorDlgBase()
	: CFormView(MotorDlgBase::IDD)
{
	//{{AFX_DATA_INIT(MotorDlgBase)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT

	m_nCurrPage = 0;
	memset( m_arhwndPage, 0, sizeof(HWND)*15 );
}

MotorDlgBase::~MotorDlgBase()
{
}

void MotorDlgBase::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(MotorDlgBase)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(MotorDlgBase, CFormView)
	//{{AFX_MSG_MAP(MotorDlgBase)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// MotorDlgBase diagnostics

#ifdef _DEBUG
void MotorDlgBase::AssertValid() const
{
	CFormView::AssertValid();
}

void MotorDlgBase::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// MotorDlgBase message handlers


////////////////////////////////////////
void MotorDlgBase::OnInitialUpdate() 
{
	CFormView::OnInitialUpdate();
	
	// TODO: Add your specialized code here and/or call the base class
	////-------------------------------------------////
	CTestFormApp *pApp=(CTestFormApp *)AfxGetApp();
	pApp->pMotorDlgBase=this;

	CRect motorBaseFrm;
	GetWindowRect(motorBaseFrm);
	//创建系统启动对话框
	beginDlg.Create(IDD_BEGINDIALOG,this);
	m_arhwndPage[0]=beginDlg.GetSafeHwnd();	
	/////////////////////////
	//创建效率试验主控对话框
	powDlg.Create(IDD_MOTORDIALOG_POWER,this);
	m_arhwndPage[1]=powDlg.GetSafeHwnd();
	//创建超载试验主控对话框
	overDlg.Create(IDD_MOTORDIALOG_OVER,this);
	m_arhwndPage[2]=overDlg.GetSafeHwnd();	
	//创建传动精度试验主控对话框
	prvDlg.Create(IDD_MOTORDIALOG_PRV,this);
	m_arhwndPage[3]=prvDlg.GetSafeHwnd();
	//创建过度过程试验主控对话框
	respDlg.Create(IDD_MOTORDIALOG_RESP,this);
	m_arhwndPage[4]=respDlg.GetSafeHwnd();
	//创建启动力矩试验主控对话框
	startDlg.Create(IDD_MOTORDIALOG_START,this);
	m_arhwndPage[5]=startDlg.GetSafeHwnd();
	//创建空程回差试验主控对话框
	blankDlg.Create(IDD_MOTORDIALOG_BLANKE,this);
	m_arhwndPage[6]=blankDlg.GetSafeHwnd();
	//创建刚度及回差试验主控对话框
	rigidDlg.Create(IDD_MOTORDIALOG_RIGID,this);
	m_arhwndPage[7]=rigidDlg.GetSafeHwnd();	
	/////////////////////////
	//创建电机调试对话框
	debgDlg.Create(IDD_MOTORDIALOG_DEBG,this);
	m_arhwndPage[8]=debgDlg.GetSafeHwnd();
	//创建效率项目对话框
	testDlg.Create(IDD_TESTDIALOG,this);
	m_arhwndPage[9]=testDlg.GetSafeHwnd();
	//创建帮助对话框
	helpDlg.Create(IDD_HELPDIALOG,this);
	m_arhwndPage[10]=helpDlg.GetSafeHwnd();	
	//创建调试对话框
	dbgDlg.Create(IDD_DEBGDIALOG,this);
	m_arhwndPage[11]=dbgDlg.GetSafeHwnd();
	//创建试验设置对话框
	setDlg.Create(IDD_SETDIALOG,this);
	m_arhwndPage[12]=setDlg.GetSafeHwnd();	

	ScreenToClient( &motorBaseFrm );
	::ShowWindow( m_arhwndPage[0], SW_SHOW );
	
	////-------------------------------------------////
	
}

///////////////////////////////
//切换窗口
void MotorDlgBase::MotorSwitchView(int nview)
{
	//DWORD flag = AW_SLIDE | AW_HOR_POSITIVE;
	//DWORD flag = AW_SLIDE | AW_CENTER;
	DWORD flag = AW_BLEND;
		//动态切换串口
		BOOL b =::AnimateWindow(
			m_arhwndPage[ nview ],
			200,
			flag
			);
	for (int i=0;i<nview;i++)
		{
			::ShowWindow( m_arhwndPage[ i ], SW_HIDE );
		}
	for (int j=nview+1;j<totalDialog;j++)
		{
			::ShowWindow( m_arhwndPage[ j ], SW_HIDE );
		}	

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -