abortdlg.cpp

来自「讲mfc的书」· C++ 代码 · 共 71 行

CPP
71
字号
// AbortDlg.cpp : implementation file
//

#include "stdafx.h"
#include "abortdll.h"
#include "AbortThread.h"
#include "AbortDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CAbortDlg dialog


CAbortDlg::CAbortDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CAbortDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CAbortDlg)
	m_text = _T("");
	//}}AFX_DATA_INIT
}


void CAbortDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAbortDlg)
	DDX_Text(pDX, IDC_TEXT, m_text);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CAbortDlg, CDialog)
	//{{AFX_MSG_MAP(CAbortDlg)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAbortDlg message handlers



void CAbortDlg::OnOK() 
{
	Thread->event->SetEvent();	
	CDialog::OnOK();
}

BOOL CAbortDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	SetTimer(1,500,NULL); // Timer every 1/2 second	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CAbortDlg::OnTimer(UINT nIDEvent) 
{
	CSingleLock lock(Thread->event,FALSE);
	if (lock.Lock(0))
		{
		CDialog::OnOK();
		}
}

⌨️ 快捷键说明

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