www.pudn.com > C8051JTAG_SRC.rar > ProgThreah.cpp


// ProgThreah.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "C8051JTAG.h" 
#include "ProgThreah.h" 
#include "C8051JTAGDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// ProgThreah 
 
IMPLEMENT_DYNCREATE(ProgThreah, CWinThread) 
 
ProgThreah::ProgThreah() 
{ 
} 
 
ProgThreah::~ProgThreah() 
{ 
} 
 
BOOL ProgThreah::InitInstance() 
{ 
	// TODO:  perform and per-thread initialization here 
	return TRUE; 
} 
 
int ProgThreah::ExitInstance() 
{ 
	// TODO:  perform any per-thread cleanup here 
	return CWinThread::ExitInstance(); 
} 
 
BEGIN_MESSAGE_MAP(ProgThreah, CWinThread) 
	//{{AFX_MSG_MAP(ProgThreah) 
	ON_THREAD_MESSAGE(WM_BEGINREAD,onRead) 
	ON_THREAD_MESSAGE(WM_BEGINWRITE,onWrite) 
	ON_THREAD_MESSAGE(WM_BEGINVERY,onVery) 
		// NOTE - the ClassWizard will add and remove mapping macros here. 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// ProgThreah message handlers 
 
int ProgThreah::Run()  
{ 
	// TODO: Add your specialized code here and/or call the base class 
	MSG msg; 
	while (PeekMessage(&msg,NULL,NULL,NULL,PM_NOREMOVE)){ 
		DispatchThreadMessage(&msg); 
	}; 
	return CWinThread::Run(); 
} 
 
 
LRESULT ProgThreah::onRead(WPARAM wParam,LPARAM lParam) 
{ 
	CC8051JTAGDlg *c8051dlg; 
	c8051dlg=(CC8051JTAGDlg *)wParam; 
	 
	c8051dlg->fnRead(); 
	AfxEndThread(0); 
	return 0; 
} 
 
LRESULT ProgThreah::onVery(WPARAM wParam,LPARAM lParam) 
{ 
	CC8051JTAGDlg *c8051dlg; 
	c8051dlg=(CC8051JTAGDlg *)wParam; 
	c8051dlg->fnVerify(); 
	AfxEndThread(0); 
	return 0; 
} 
 
LRESULT ProgThreah::onWrite(WPARAM wParam,LPARAM lParam) 
{ 
	CC8051JTAGDlg *c8051dlg; 
	c8051dlg=(CC8051JTAGDlg *)wParam; 
	c8051dlg->fnWriteVery(); 
	AfxEndThread(0); 
	return 0; 
}