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

📄 mythread.cpp

📁 《windows程序设计》王艳平版的书籍源代码
💻 CPP
字号:
///////////////////////////////////////////////////////////////
// MyThread.cpp文件


#include <stdio.h>
#include "../common/_afxwin.h"



UINT MyFunc(LPVOID lpParam)
{
	printf(" Thread Identify: %d \n", AfxGetThread()->m_nThreadID);
	return 0;
}

void main()
{
	for(int i=0; i<10; i++)
	{
		AfxBeginThread(MyFunc, NULL);
	}
	system("pause");
}



/*

UINT MyFunc(LPVOID lpParam)
{
	printf(" Thread Identify: %d \n", AfxGetThread()->m_nThreadID);
	return 0;
}

void main()
{
	CWinThread* pThread = AfxBeginThread (MyFunc, NULL,
				THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
//	pThread->m_bAutoDelete = FALSE;
	pThread->ResumeThread ();
	
	// Sometime later
	DWORD dwExitCode;
	::GetExitCodeThread (pThread->m_hThread, &dwExitCode);
	if (dwExitCode == STILL_ACTIVE) 
	{
		// The thread is still running.
	}
	else 
	{
		// The thread has terminated. Delete the CWinThread object.
		delete pThread;
	}

	system("pause");
}
*/






⌨️ 快捷键说明

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