MFC多线程

主要分为以下几步

  1. 在类中声明线程函数并定义
static UINT ThreadAdd(LPVOID pParam);
static UINT ThreadSub(LPVOID pParam);
UINT CMFCThreadDlg::ThreadAdd(LPVOID pParam)
{
	CMFCThreadDlg* pThis = (CMFCThreadDlg*)pParam;
	//XXXXXXXXX具体函数功能
	return 0;
}


UINT CMFCThreadDlg::ThreadSub(LPVOID pParam)
{
	CMFCThreadDlg* pThis = (CMFCThreadDlg*)pParam;
	//XXXXXXXXX具体函数功能
	return 0;
}
  1. 创建线程函数
CWinThread* pAddThread = ::AfxBeginThread(ThreadAdd, this);
CWinThread* pSubThread = ::AfxBeginThread(ThreadSub, this);

你可能感兴趣的:(MFC,mfc,c++)