MyLabJackDlg.h
// MyLabJackDlg.h : 头文件
//
#pragma once
#include "afxwin.h"
#include <stdio.h>
#include <windows.h>
#include "C:\Program Files (x86)\LabJack\Drivers\LabJackUD.h"
// CMyLabJackDlg 对话框
class CMyLabJackDlg : public CDialogEx
{
// 构造
public:
CMyLabJackDlg(CWnd* pParent = NULL); // 标准构造函数
// 对话框数据
enum { IDD = IDD_MYLABJACK_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
HICON m_hIcon;
// 生成的消息映射函数
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
CString Edit_AIN0;
CString Edit_AIN1;
CString Edit_AIN2;
CString Edit_AIN3;
CButton bt_start;
CButton bt_stop;
double StartAIN0;
double StartAIN1;
bool setvalue;
bool timerstate;
LJ_ERROR lngErrorcode;
LJ_HANDLE lngHandle;
double dblValue;
long lngValue;
long lngBinary;
afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg void OnBnClickedButton1();
afx_msg void OnBnClickedButton2();
afx_msg void OnBnClickedButton3();
CString Edit_SAIN0;
CString Edit_SAIN1;
CString Edit_Arcsin0;
CString Edit_Arcsin1;
CButton bt_setvalue;
void ErrorHandler (LJ_ERROR lngErrorcode, long lngLineNumber, long lngIteration);
};
MyLabJackDlg.cpp
// MyLabJackDlg.cpp : 实现文件
//
#include "stdafx.h"
#include "MyLabJack.h"
#include "MyLabJackDlg.h"
#include "afxdialogex.h"
#include <math.h>
#include <iostream>
#include <fstream>
using namespace std;
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
class CAboutDlg : public CDialogEx
{
public:
CAboutDlg();
// 对话框数据
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
ON_WM_MOVING()
END_MESSAGE_MAP()
// CMyLabJackDlg 对话框
CMyLabJackDlg::CMyLabJackDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(CMyLabJackDlg::IDD, pParent)
, Edit_SAIN0(_T(""))
, Edit_SAIN1(_T(""))
, Edit_Arcsin0(_T(""))
, Edit_Arcsin1(_T(""))
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
Edit_AIN0 = _T("");
}
void CMyLabJackDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_BUTTON1, bt_start);
DDX_Control(pDX, IDC_BUTTON2, bt_stop);
DDX_Text(pDX, IDC_EDIT1, Edit_AIN0);
DDV_MaxChars(pDX, Edit_AIN0, 30);
DDX_Text(pDX, IDC_EDIT2, Edit_AIN1);
DDV_MaxChars(pDX, Edit_AIN1, 30);
DDX_Text(pDX, IDC_EDIT3, Edit_AIN2);
DDV_MaxChars(pDX, Edit_AIN2, 30);
DDX_Text(pDX, IDC_EDIT4, Edit_AIN3);
DDV_MaxChars(pDX, Edit_AIN3, 30);
DDX_Text(pDX, IDC_EDIT5, Edit_SAIN0);
DDV_MaxChars(pDX, Edit_SAIN0, 30);
DDX_Text(pDX, IDC_EDIT6, Edit_SAIN1);
DDV_MaxChars(pDX, Edit_SAIN1, 30);
DDX_Text(pDX, IDC_EDIT7, Edit_Arcsin0);
DDV_MaxChars(pDX, Edit_Arcsin0, 30);
DDX_Text(pDX, IDC_EDIT8, Edit_Arcsin1);
DDX_Control(pDX, IDC_BUTTON3, bt_setvalue);
}
BEGIN_MESSAGE_MAP(CMyLabJackDlg, CDialogEx)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1, &CMyLabJackDlg::OnBnClickedButton1)
ON_WM_TIMER()
ON_BN_CLICKED(IDC_BUTTON2, &CMyLabJackDlg::OnBnClickedButton2)
ON_BN_CLICKED(IDC_BUTTON3, &CMyLabJackDlg::OnBnClickedButton3)
END_MESSAGE_MAP()
//This is our 易做图 error handling function that is called after every UD
//function call. This function displays t
补充:综合编程 , 其他综合 ,