???????

????MFC???????????????????????AfxBeginThread??????????ù??????????????this??????????????????????????

????????

??????????????

????1.1Test.h

#pragma once
class CTest
{
public:
CTest(void);
~CTest(void);
void ThreadMethod(HWND hWnd);
HWND m_hWnd;
};

????1.2????Test.cpp

#include "StdAfx.h"
#include "Test.h"
CTest::CTest(void)
{
}
CTest::~CTest(void)
{
}

UINT ThreadProc(LPVOID lpParam)
{
CTest* test = (CTest*)lpParam;
HWND hWnd = test->m_hWnd;
return 0;
}
void CTest::ThreadMethod(HWND hWnd)
{
this->m_hWnd = hWnd;
AfxBeginThread(ThreadProc??this);
}

????1.3????MFC?????巽??????

CTest test;
test.ThreadMethod(m_hWnd);

????1.4????????????

??????????ThreadProc???????HWND hWnd = test->m_hWnd;??????з????????????CTest::ThreadMethod????????????????л??????????????int????????CString??????????????????????

?????????????

??????test??????????????????????÷????????£?

test = new CTest();
test->ThreadMethod(m_hWnd);

????test?????????????????????ζ??????????????

??????????

?????????????Σ????????????????????????????????ò????????????3????????????????????