wzdthrd.cpp

来自「MFC扩展编程实例」· C++ 代码 · 共 35 行

CPP
35
字号
// WzdThrd.cpp : thread process
//

#include "stdafx.h"
#include "WzdThrd.h"

/////////////////////////////////////////////////////////////////////////////
// CWzdThread

UINT WzdThread( LPVOID pParam )
{
	// get data from thread creator
	THREADDATA *pData=(THREADDATA *)pParam;

	// get current data
	int nInt;
	float fFloat;
	DWORD dwWord;
	pData->pWzdData->GetData(&nInt,&fFloat,&dwWord);

	// do calulations
	for (int i=nInt;i<1000000;i++)
	{
	}

	// save data back to thread creator
	pData->pWzdData->SetData(nInt,fFloat,dwWord);

	// tell creator we're done
	::SendMessage(pData->hDoneWnd, WM_DONE, 0, 0);

	return 0;	// return value up to you--parent can retrieve with GetExitCodeThread();
				// can also call AfxEndThread(0) where the meaning of the argument is up to you
}

⌨️ 快捷键说明

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