www.pudn.com > CarCrash.rar > CarThread.h


#if !defined(AFX_CARTHREAD_H__A6C98EBD_E092_4516_A311_76D38E94C843__INCLUDED_) 
#define AFX_CARTHREAD_H__A6C98EBD_E092_4516_A311_76D38E94C843__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
// CarThread.h : header file 
// 
#pragma  warning(disable:4786) 
#include  
using namespace std; 
 
#define MSG_KILLME	WM_USER+1 
 
///////////////////////////////////////////////////////////////////////////// 
// CCarThread thread 
 
class CCarThread : public CWinThread 
{ 
	DECLARE_DYNCREATE(CCarThread) 
protected: 
	CCarThread();           // protected constructor used by dynamic creation 
	HDC m_hDC; 
	CDC m_DC; 
	CWnd *m_pParent; 
	int m_nBmpId; 
	CPoint m_ptPosition,m_ptVelocity; 
	 
	HANDLE m_hEventDead; 
	CRect m_pMainBorder,m_bmpRect; 
	int	 m_nChanged; 
	static	CBitmap m_bmpCars[8]; 
public: 
	static CRITICAL_SECTION cs; 
	static CRITICAL_SECTION csCrash; 
	static CDC m_MemDC; 
	void UpdateBorder(); 
	void KillThread(); 
	bool RandomVelocityChange(); 
	static 	vector m_Cars; 
	static  bool CheckCrash(CCarThread*,vector**ppThreadKilled); 
	static void Initialize(); 
	HANDLE m_hEventKill; 
	 
	 
// Attributes 
public: 
	CCarThread(CWnd *pParent,HDC hDC,CRect r); 
	virtual void Delete(); 
	void UpdateBitmap(); 
// Operations 
public: 
 
// Overrides 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CCarThread) 
	public: 
	virtual BOOL InitInstance(); 
	virtual int ExitInstance(); 
	//}}AFX_VIRTUAL 
 
// Implementation 
protected: 
	virtual ~CCarThread(); 
 
	// Generated message map functions 
	//{{AFX_MSG(CCarThread) 
		// NOTE - the ClassWizard will add and remove member functions here. 
	//}}AFX_MSG 
 
	DECLARE_MESSAGE_MAP() 
}; 
 
///////////////////////////////////////////////////////////////////////////// 
 
//{{AFX_INSERT_LOCATION}} 
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. 
 
#endif // !defined(AFX_CARTHREAD_H__A6C98EBD_E092_4516_A311_76D38E94C843__INCLUDED_)