最近研究了一下这个题目,其实也是一个作业,早写完了,参考了什么也都忘了实现过程很简单,代码量也很小
首先添加CWinThread派生类TestThread
然后,改造一下相关的 TestThread.h 和.cpp文件
#pragma once
#define WM_TEST WM_USER+10
#define WM_DISPLAY WM_USER+20
// CTestThread
class CTestThread : public CWinThread
{
DECLARE_DYNCREATE(CTestThread)
protected:
CTestThread(); // 动态创建所使用的受保护的构造函数
virtual ~CTestThread();
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
protected:
afx_msg void OnUserProc(WPARAM wParam, LPARAM lParam);
afx_msg void OnTest(WPARAM wParam,LPARAM lParam);
afx_msg void OnDisplay(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
};
// TestThread.cpp : 实现文件
//
#inc