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

📄 thread_base.h

📁 类似QQ,MSN表情的richedit,用来测试表情控件的
💻 H
字号:
#ifndef _THREAD_BASE_H
#define _THREAD_BASE_H
#include "windows.h"
class thread_base
{
private:
	HANDLE	threadhandle;
	bool	beixt;

	static DWORD WINAPI _entry(LPVOID param)
	{
		thread_base* p = (thread_base*)param;
		p->entry() ;
		return 0;
	}

protected:
	virtual ~thread_base()
	{
		threadclose();
	}
	virtual void entry() =0;
public:
	thread_base()
	{
		threadhandle = NULL;
		beixt = false;
	}
	bool threadstart(int prior)
	{
		if(threadhandle != NULL)
			return false;
		ULONG id;
		threadhandle = CreateThread(NULL, 0, _entry, this,	0, &id) ;
		if (threadhandle == NULL)  
			return false;		
		SetThreadPriority(threadhandle, prior) ;
		return true;
	}

	bool threadcheck()
	{
		return beixt;
	}

	void threadexit()
	{
		beixt = true;
	}

	bool threadclose()
	{
		if(threadhandle != NULL)
		{
			beixt = true;
			WaitForSingleObject(threadhandle, INFINITE) ;
			CloseHandle(threadhandle);
		}
		threadhandle = NULL;
		
		return true;
	}
};
	

#endif

⌨️ 快捷键说明

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