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

📄 digpid.cpp

📁 我自己早期编写的闭环控制小程序。一个DLL实现的PID控制器
💻 CPP
字号:
// DigPID.cpp : implementation file
//

#include "stdafx.h"
#include "SimuFlat.h"
#include "DigPID.h"
#include "SimuFlatDoc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDigPID dialog


CDigPID::CDigPID(CWnd* pParent /*=NULL*/)
	: CDialog(CDigPID::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDigPID)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CDigPID::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDigPID)
	DDX_Control(pDX, IDC_EDIT1, m_Edit1);
	DDX_Control(pDX, IDC_SLIDER1, m_Slider1);
	//}}AFX_DATA_MAP
	m_Slider1.SetRangeMax(1000);
	m_Slider1.SetPos((int)(((CSimuFlatDoc*)((CFrameWnd*)((CSimuFlatApp*)AfxGetApp())->GetMainWnd())->GetActiveDocument())->newsp));
	CString str;
	str.Format("%d",m_Slider1.GetPos());
	m_Edit1.SetWindowText(str);
}


BEGIN_MESSAGE_MAP(CDigPID, CDialog)
	//{{AFX_MSG_MAP(CDigPID)
	ON_BN_CLICKED(ID_OK, OnOk)
	ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER1, OnReleasedcaptureSlider1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDigPID message handlers

void CDigPID::OnOk() 
{
	// TODO: Add your control notification handler code here
	((CSimuFlatDoc*)((CFrameWnd*)((CSimuFlatApp*)AfxGetApp())->GetMainWnd())->GetActiveDocument())->newsp=(float)m_Slider1.GetPos();	
	CDialog::OnOK();
}

void CDigPID::OnReleasedcaptureSlider1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	
	CString str;
	str.Format("%d",m_Slider1.GetPos());
	m_Edit1.SetWindowText(str);
	*pResult = 0;
}

⌨️ 快捷键说明

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