小白一枚,拿到的MFC程式
// Dialog_SelConfig_SMV.cpp : implementation file
//
#include "stdafx.h"
#include "ProcessBusTool.h"
#include "Dialog_SelConfig_SMV.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDialog_SelConfig_SMV dialog
CDialog_SelConfig_SMV::CDialog_SelConfig_SMV(CWnd* pParent /*=NULL*/)
: CDialog(CDialog_SelConfig_SMV::IDD, pParent)
{
//{{AFX_DATA_INIT(CDialog_SelConfig_SMV)
/* m_noASDU = TRUE;//FALSE;
m_security = FALSE;
m_svid = TRUE;//FALSE;
m_datset = FALSE;
m_smpCnt = TRUE;//FALSE;
m_confRev = TRUE;//FALSE;
m_refrTm = FALSE;
m_smpSynch = FALSE;
m_smpRate = FALSE;
m_DataLen = TRUE;//FALSE;
m_text_security = _T("");
m_text_svid = _T("GXU_SMV");
m_text_datset = _T("");
m_text_confRev = 1;
m_text_smpSynch = FALSE;
m_text_smpCnt = 0;
m_text_smpRate = 80;
m_text_DataLen = 64;
m_text_noASDU = 1;*/
//}}AFX_DATA_INIT
}
void CDialog_SelConfig_SMV::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDialog_SelConfig_SMV)
DDX_Check(pDX, IDC_CHECK1, m_noASDU);
DDX_Check(pDX, IDC_CHECK2, m_security);
DDX_Check(pDX, IDC_CHECK3, m_svid);
DDX_Check(pDX, IDC_CHECK4, m_datset);
DDX_Check(pDX, IDC_CHECK5, m_smpCnt);
DDX_Check(pDX, IDC_CHECK6, m_confRev);
DDX_Check(pDX, IDC_CHECK7, m_refrTm);
DDX_Check(pDX, IDC_CHECK8, m_smpSynch);
DDX_Check(pDX, IDC_CHECK9, m_smpRate);
DDX_Check(pDX, IDC_CHECK10, m_DataLen);
DDX_Text(pDX, IDC_EDIT2, m_text_security);
DDV_MaxChars(pDX, m_text_security, 64);
DDX_Text(pDX, IDC_EDIT3, m_text_svid);
DDV_MaxChars(pDX, m_text_svid, 64);
DDX_Text(pDX, IDC_EDIT4, m_text_datset);
DDV_MaxChars(pDX, m_text_datset, 64);
DDX_Text(pDX, IDC_EDIT6, m_text_confRev);
DDX_Text(pDX, IDC_EDIT8, m_text_smpSynch);
DDX_Text(pDX, IDC_EDIT5, m_text_smpCnt);
DDX_Text(pDX, IDC_EDIT9, m_text_smpRate);
DDV_MinMaxInt(pDX, m_text_smpRate, 0, 10000);
DDX_Text(pDX, IDC_EDIT10, m_text_DataLen);
DDX_Text(pDX, IDC_EDIT1, m_text_noASDU);
DDV_MinMaxByte(pDX, m_text_noASDU, 0, 32);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDialog_SelConfig_SMV, CDialog)
//{{AFX_MSG_MAP(CDialog_SelConfig_SMV)
ON_WM_CANCELMODE()
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_CHECK9, OnCheck9)
ON_BN_CLICKED(IDC_CHECK10, OnCheck10)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDialog_SelConfig_SMV message handlers
BOOL CDialog_SelConfig_SMV::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
TextCheck();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDialog_SelConfig_SMV::OnCancelMode()
{
CDialog::OnCancelMode();
// TODO: Add your message handler code here
}
void CDialog_SelConfig_SMV::TextCheck()
{
TextCheck0(IDC_EDIT1, m_noASDU);
// TextCheck0(IDC_EDIT2, m_security);
TextCheck0(IDC_EDIT3, m_svid);
TextCheck0(IDC_EDIT4, m_datset);
TextCheck0(IDC_EDIT6, m_confRev);
TextCheck0(IDC_EDIT9, m_smpRate);
TextCheck0(IDC_EDIT10,m_DataLen);
/* for(int i=IDC_EDIT1;i<10+IDC_EDIT1;i++)
((CWnd* )GetDlgItem(i))->EnableWindow(0);*/
}
void CDialog_SelConfig_SMV::OnCheck1()
{
// TODO: Add your control notification handler code here
UpdateData(1);
TextCheck0(IDC_EDIT1,m_noASDU);
}
void CDialog_SelConfig_SMV::OnCheck2()
{
// TODO: Add your control notification handler code here
//UpdateData(1);
//TextCheck0(IDC_EDIT1,m_noASDU)
}
void CDialog_SelConfig_SMV::OnCheck3()
{
// TODO: Add your control notification handler code here
UpdateData(1);
TextCheck0(IDC_EDIT3,m_svid);
}
void CDialog_SelConfig_SMV::OnCheck4()
{
// TODO: Add your control notification handler code here
UpdateData(1);
TextCheck0(IDC_EDIT4,m_datset);
}
void CDialog_SelConfig_SMV::OnCheck5()
{
// TODO: Add your control notification handler code here
}
void CDialog_SelConfig_SMV::OnCheck6()
{
// TODO: Add your control notification handler code here
UpdateData(1);
TextCheck0(IDC_EDIT6,m_confRev);
}
void CDialog_SelConfig_SMV::OnCheck7()
{
// TODO: Add your control notification handler code here
}
void CDialog_SelConfig_SMV::OnCheck8()
{
// TODO: Add your control notification handler code here
UpdateData(1);
//if(m_smpSynch)m_text_smpSynch=1;
//else m_text_smpSynch=0;
TextCheck0(IDC_EDIT9,m_smpRate);
UpdateData(0);
}
void CDialog_SelConfig_SMV::OnCheck9()
{
// TODO: Add your control notification handler code here
UpdateData(1);
TextCheck0(IDC_EDIT9,m_smpRate);
}
void CDialog_SelConfig_SMV::OnCheck10()
{
// TODO: Add your control notification handler code here
}
void CDialog_SelConfig_SMV::TextCheck0(int idc, bool check)
{
if(check)((CWnd* )GetDlgItem(idc))->EnableWindow(1);
else ((CWnd* )GetDlgItem(idc))->EnableWindow(0);
}
運行后出錯,Dialog_SelConfig_SMV.exe 遇到問題需要關閉。我們對此引起的不便表示抱歉。
除錯停在了,好像是指標空了,具體是什么問題呢
if (!pThread->InitInstance())
{
if (pThread->m_pMainWnd != NULL)
{
TRACE0("Warning: Destroying non-NULL m_pMainWnd\n");
pThread->m_pMainWnd->DestroyWindow();
}
nReturnCode = pThread->ExitInstance();
goto InitFailure;
}
nReturnCode = pThread->Run();
uj5u.com熱心網友回復:
(CWnd* )GetDlgItem(idc)
uj5u.com熱心網友回復:
請大神明示
uj5u.com熱心網友回復:
除錯時 callback 視窗中 ,要 看 你寫的 函式, 像 if (!pThread->InitInstance()) 這樣的 陳述句 不是你寫的 要 跳過直到 你寫的 函式uj5u.com熱心網友回復:
你把斷點停在這你看是不是這句出的錯,我感覺應該是這里轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/153488.html
標籤:基礎類
上一篇:mysql.data.mysqlclient的資料提供程式,無法獲得提供程式工廠
下一篇:OnBackSpace處理回退鍵
