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

📄 counterthread.cpp

📁 从学案例入手
💻 CPP
字号:
// CounterThread.cpp: implementation of the CCounterThread class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "UIThread.h"
#include "CounterThread.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNCREATE(CCounterThread,CExampleThread)

CCounterThread::CCounterThread()
{

}

CCounterThread::~CCounterThread()
{

}

CCounterThread::Run()
{
	BOOL fSyncChecked;
	CString strBuffer;
	
	ASSERT(m_pOwner != NULL);
	if (m_pOwner == NULL)
		return -1;

	CSingleLock sLock(&(m_pOwner->m_mutex));
	while (!m_bDone)
	{
		fSyncChecked = m_pOwner->IsDlgButtonChecked(IDC_SYNCHRONIZE);
		if (fSyncChecked)
			sLock.Lock();
		//构建要显示的字符串
		strBuffer=_T("Display: ");
		strBuffer+=m_pOwner->m_strNumber;
		if (fSyncChecked)
			sLock.Unlock();

		//将字符串加入到列表框中
		m_pOwner->AddToListBox(strBuffer);
		Sleep(1000);
	}//结束while
	m_pOwner->PostMessage(WM_CLOSE, 0, 0L);

	return 0;
}

⌨️ 快捷键说明

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