各位,我现在做毕设,马上就要答辩了,还有问题没解决,麻烦各位帮我看一下,哪里出错了,怎么解决,谢谢。
C:\Documents and Settings\Administrator\桌面\杨立宝的毕业设计\资料\木易\TESTMP4\TESTMP4Dlg.cpp(238) : error C2601: 'OnSysCommand' : local function definitions are illegalC:\Documents and Settings\Administrator\桌面\杨立宝的毕业设计\资料\木易\TESTMP4\TESTMP4Dlg.cpp(238) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Error executing cl.exe.
Creating browse info file...
BSCMAKE: error BK1506 : cannot open file '.\Debug\TESTMP4Dlg.sbr': No such file or directory
Error executing bscmake.exe.
TESTMP4.exe - 3 error(s), 0 warning(s)
// TESTMP4Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "TESTMP4.h"
#include "TESTMP4Dlg.h"
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#pragma comment(lib,"mp401.lib")
#include "mp401.h"
#pragma comment(lib,"MP431.lib")
#include "MP431.h"
HANDLE hDevice401=INVALID_HANDLE_VALUE;
HANDLE hDevice431=INVALID_HANDLE_VALUE;
CDC *pDC;
CWnd* pWnd;
CRect rect;
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTESTMP4Dlg dialog
CTESTMP4Dlg::CTESTMP4Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CTESTMP4Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CTESTMP4Dlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CTESTMP4Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTESTMP4Dlg)
DDX_Control(pDX, IDC_SCROLLBAR9, m_PData9);
DDX_Control(pDX, IDC_SCROLLBAR8, m_PData8);
DDX_Control(pDX, IDC_SCROLLBAR6, m_PData6);
DDX_Control(pDX, IDC_SCROLLBAR7, m_PData7);
DDX_Control(pDX, IDC_SCROLLBAR5, m_PData5);
DDX_Control(pDX, IDC_SCROLLBAR4, m_PData4);
DDX_Control(pDX, IDC_SCROLLBAR3, m_PData3);
DDX_Control(pDX, IDC_SCROLLBAR2, m_PData2);
DDX_Control(pDX, IDC_SCROLLBAR13, m_PData13);
DDX_Control(pDX, IDC_SCROLLBAR12, m_PData12);
DDX_Control(pDX, IDC_SCROLLBAR11, m_PData11);
DDX_Control(pDX, IDC_SCROLLBAR10, m_PData10);
DDX_Control(pDX, IDC_SCROLLBAR1, m_PData1);
DDX_Control(pDX, IDC_CHECK9, m_cont9);
DDX_Control(pDX, IDC_CHECK8, m_cont8);
DDX_Control(pDX, IDC_CHECK7, m_cont7);
DDX_Control(pDX, IDC_CHECK6, m_cont6);
DDX_Control(pDX, IDC_CHECK5, m_cont5);
DDX_Control(pDX, IDC_CHECK45, m_cont45);
DDX_Control(pDX, IDC_CHECK44, m_cont44);
DDX_Control(pDX, IDC_CHECK43, m_cont43);
DDX_Control(pDX, IDC_CHECK42, m_cont42);
DDX_Control(pDX, IDC_CHECK41, m_cont41);
DDX_Control(pDX, IDC_CHECK40, m_cont40);
DDX_Control(pDX, IDC_CHECK4, m_cont4);
DDX_Control(pDX, IDC_CHECK39, m_cont39);
DDX_Control(pDX, IDC_CHECK38, m_cont38);
DDX_Control(pDX, IDC_CHECK37, m_cont37);
DDX_Control(pDX, IDC_CHECK36, m_cont36);
DDX_Control(pDX, IDC_CHECK35, m_cont35);
DDX_Control(pDX, IDC_CHECK34, m_cont34);
DDX_Control(pDX, IDC_CHECK33, m_cont33);
DDX_Control(pDX, IDC_CHECK32, m_cont32);
DDX_Control(pDX, IDC_CHECK31, m_cont31);
DDX_Control(pDX, IDC_CHECK30, m_cont30);
DDX_Control(pDX, IDC_CHECK29, m_cont29);
DDX_Control(pDX, IDC_CHECK3, m_cont3);
DDX_Control(pDX, IDC_CHECK28, m_cont28);
DDX_Control(pDX, IDC_CHECK27, m_cont27);
DDX_Control(pDX, IDC_CHECK26, m_cont26);
DDX_Control(pDX, IDC_CHECK25, m_cont25);
DDX_Control(pDX, IDC_CHECK24, m_cont24);
DDX_Control(pDX, IDC_CHECK23, m_cont23);
DDX_Control(pDX, IDC_CHECK22, m_cont22);
DDX_Control(pDX, IDC_CHECK21, m_cont21);
DDX_Control(pDX, IDC_CHECK20, m_cont20);
DDX_Control(pDX, IDC_CHECK2, m_cont2);
DDX_Control(pDX, IDC_CHECK19, m_cont19);
DDX_Control(pDX, IDC_CHECK18, m_cont18);
DDX_Control(pDX, IDC_CHECK17, m_cont17);
DDX_Control(pDX, IDC_CHECK16, m_cont16);
DDX_Control(pDX, IDC_CHECK15, m_cont15);
DDX_Control(pDX, IDC_CHECK14, m_cont14);
DDX_Control(pDX, IDC_CHECK13, m_cont13);
DDX_Control(pDX, IDC_CHECK12, m_cont12);
DDX_Control(pDX, IDC_CHECK11, m_cont11);
DDX_Control(pDX, IDC_CHECK10, m_cont10);
DDX_Control(pDX, IDC_CHECK1, m_cont1);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTESTMP4Dlg, CDialog)
//{{AFX_MSG_MAP(CTESTMP4Dlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_B_SCAN, OnBScan)
ON_BN_CLICKED(IDC_B_TEST, OnBTest)
ON_BN_CLICKED(IDCANCLE, OnCancle)
ON_BN_CLICKED(IDC_CHECK9, OnCheck9)
ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
ON_BN_CLICKED(IDC_CHECK2, OnCheck2)
ON_BN_CLICKED(IDC_CHECK3, OnCheck3)
ON_BN_CLICKED(IDC_CHECK4, OnCheck4)
ON_BN_CLICKED(IDC_CHECK5, OnCheck5)
ON_BN_CLICKED(IDC_CHECK6, OnCheck6)
ON_BN_CLICKED(IDC_CHECK7, OnCheck7)
ON_BN_CLICKED(IDC_CHECK8, OnCheck8)
ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
ON_WM_TIMER()
ON_WM_VSCROLL()
ON_WM_CREATE()
ON_BN_CLICKED(IDC_RADIO5, OnRadio5)
ON_BN_CLICKED(IDC_RADIO10, OnRadio10)
ON_BN_CLICKED(IDC_RADIO11, OnRadio11)
ON_BN_CLICKED(IDC_RADIO12, OnRadio12)
ON_BN_CLICKED(IDC_RADIO6, OnRadio6)
ON_BN_CLICKED(IDC_RADIO7, OnRadio7)
ON_BN_CLICKED(IDC_RADIO8, OnRadio8)
ON_BN_CLICKED(IDC_RADIO9, OnRadio9)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTESTMP4Dlg message handlers
BOOL CTESTMP4Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
hDevice401=INVALID_HANDLE_VALUE;
hDevice401=MP401_OpenDevice(0);//打开驱动
if(hDevice401==INVALID_HANDLE_VALUE){
Beep(1000,300);
AfxMessageBox("未检测到MP401,请检查硬件是否连接正确!");
//exit(0);
}
else{
int j;
MP401_ADSET(hDevice401,0, 0,0);
MP401_CAL(hDevice401);
do
{
j=MP401_CALPOLL(hDevice401);
}while(j!=0);
return TRUE; // return TRUE unless you set the focus to a control
}
void CTESTMP4Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CTESTMP4Dlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CTESTMP4Dlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CTESTMP4Dlg::OnCheck1()
{
// TODO: Add your control notification handler code here
int DO0;
DO0=m_Cont0.GetCheck();
DOData=(DOData & 0xfe) + DO0;
ShowDO();
}
void CTESTMP4Dlg::OnCheck2()
{
// TODO: Add your control notification handler code here
int DO1;
DO1=m_Cont1.GetCheck();
DOData=(DOData & 0xfd) + (DO1<<1);
ShowDO();
}
void CTESTMP4Dlg::OnCheck3()
{
// TODO: Add your control notification handler code here
int DO2;
DO2=m_Cont2.GetCheck();
DOData=(DOData & 0xfb) + (DO2<<2);
ShowDO();
}
void CTESTMP4Dlg::OnCheck4()
{
// TODO: Add your control notification handler code here
int DO3;
DO3=m_Cont3.GetCheck();
DOData=(DOData & 0xf7) + (DO3<<3);
ShowDO();
}
void CTESTMP4Dlg::OnCheck5()
{
// TODO: Add your control notification handler code here
int DO4;
DO4=m_Cont4.GetCheck();
DOData=(DOData & 0xef) + (DO4<<4);
ShowDO();
}
void CTESTMP4Dlg::OnCheck6()
{
// TODO: Add your control notification handler code here
int DO5;
DO5=m_Cont5.GetCheck();
DOData=(DOData & 0xdf) + (DO5<<5);
ShowDO();
}
void CTESTMP4Dlg::OnCheck7()
{
// TODO: Add your control notification handler code here
int DO6;
DO6=m_Cont6.GetCheck();
DOData=(DOData & 0xbf) + (DO6<<6);
ShowDO();
}
void CTESTMP4Dlg::OnCheck8()
{
// TODO: Add your control notification handler code here
int DO7;
DO7=m_Cont7.GetCheck();
DOData=(DOData & 0x7f) + (DO7<<7);
ShowDO();
}
BOOL CTESTMP4Dlg::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::Create(IDD, pParentWnd);
}
void CTESTMP4Dlg::OnRadio1()
{
// TODO: Add your control notification handler code here
SetChanNCal(0);
}
void CTESTMP4Dlg::OnRadio2()
{
// TODO: Add your control notification handler code here
SetChanNCal(1);
}
void CTESTMP4Dlg::OnRadio3()
{
// TODO: Add your control notification handler code here
SetChanNCal(2);
}
void CTESTMP4Dlg::OnRadio4()
{
// TODO: Add your control notification handler code here
SetChanNCal(3);
}
void CTESTMP4Dlg::OnRadio5()
{
// TODO: Add your control notification handler code here
SetChanNCal(4);
}
void CTESTMP4Dlg::OnRadio6()
{
// TODO: Add your control notification handler code here
SetChanNCal(5);
}
void CTESTMP4Dlg::OnRadio7()
{
// TODO: Add your control notification handler code here
SetChanNCal(6);
}
void CTESTMP4Dlg::OnRadio8()
{
// TODO: Add your control notification handler code here
SetChanNCal(7);
}
void CTESTMP4Dlg::OnRadio9()
{
// TODO: Add your control notification handler code here
SetChanNCal(8);
}
void CTESTMP4Dlg::OnRadio10()
{
// TODO: Add your control notification handler code here
SetChanNCal(9);
}
void CTESTMP4Dlg::OnRadio11()
{
// TODO: Add your control notification handler code here
SetChanNCal(10);
}
void CTESTMP4Dlg::OnRadio12()
{
// TODO: Add your control notification handler code here
SetChanNCal(11);
}
void CTESTMP4Dlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
CDialog::OnTimer(nIDEvent);
if(nIDEvent==1)
{
pWnd=GetDlgItem(IDC_STATIC_RED);
pWnd->GetClientRect(&rect);
pDC=pWnd->GetDC();
pDC->FillSolidRect(&rect,RGB(255,0,0));
ReleaseDC(pDC);
pWnd=GetDlgItem(IDC_STATIC_GREEN);
pWnd->GetClientRect(&rect);
pDC=pWnd->GetDC();
pDC->FillSolidRect(&rect,RGB(0,255,0));
ReleaseDC(pDC);
ShowDI();
}
}
int CTESTMP4Dlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
hDevice=MP431_OpenDevice(0);
if(hDevice==INVALID_HANDLE_VALUE)
{
Beep(1000,300);
AfxMessageBox("Error Open MP431, Check Driver or USB Device");
exit(0);
}
return 0;
}
void CTESTMP4Dlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
m_PData.SetScrollRange(0,4095);//设置滚动条即ad_timer值范围
int iNowPos;
switch(nSBCode)
{
if(pScrollBar==&m_PData)
{
case SB_THUMBTRACK:
m_PData.SetScrollPos(nPos);
break;
case SB_LINERIGHT:
iNowPos=m_PData.GetScrollPos();
iNowPos=iNowPos+1;
if(iNowPos>4095)
iNowPos=4095;
m_PData.SetScrollPos(iNowPos);
break;
case SB_LINELEFT:
iNowPos=m_PData.GetScrollPos();
iNowPos=iNowPos-1;
if(iNowPos<10)iNowPos=10;
m_PData.SetScrollPos(iNowPos);
break;
case SB_PAGELEFT:
iNowPos=m_PData.GetScrollPos();
iNowPos=iNowPos-10;
if(iNowPos<10)iNowPos=10;
m_PData.SetScrollPos(iNowPos);
break;
case SB_PAGERIGHT:
iNowPos=m_PData.GetScrollPos();
iNowPos=iNowPos+10;
if(iNowPos>4095)iNowPos=4095;
m_PData.SetScrollPos(iNowPos);
break;
}
}
//显示采样频率
MP431_CAL(hDevice,DACH,gain,m_PData.GetScrollPos());
MP431_StarDA(hDevice);
MP431_DA(hDevice,DACH,gain,m_PData.GetScrollPos());
CString aa,str;
double Vol;
switch(gain)
{
case 0:
Vol=m_PData.GetScrollPos()*5.0/4095.0;
break;
case 1:
Vol=m_PData.GetScrollPos()*10.0/4095.0;
break;
case 2:
Vol=(m_PData.GetScrollPos()-2048.0)*5.0/2048.0;
break;
}
//显示电压值
str.Format("%.3fV",Vol);
GetDlgItem(IDC_EDIT_DAV)->SetWindowText(str);
//显示DAData
aa.Format("%d",m_PData.GetScrollPos());
GetDlgItem(IDC_EDIT_DAData)->SetWindowText(aa);
}
void CTESTMP4Dlg::OnBScan()
{
// TODO: Add your control notification handler code here
InScanMode=!InScanMode;
if(InScanMode){
SetTimer(1,100,NULL);
(CButton *)(GetDlgItem(IDC_B_SCAN))->SetCheck(1);
}
else{
KillTimer(1);
}
}
void CTESTMP4Dlg::OnBTest()
{
// TODO: Add your control notification handler code here
if(hDevice401!=INVALID_HANDLE_VALUE){
if()
}
if(hDevice431!=INVALID_HANDLE_VALUE){
}
}
void CTESTMP4Dlg::OnChangeEdit9()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}