www.pudn.com > ThreadCompete.rar > ThreadCompete.cpp


 
#include "stdafx.h" 
#include "ThreadCompete.h" 
#include "MainFrm.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
class CAboutDlg : public CDialog 
{ 
public: 
	CAboutDlg(); 
 
	//{{AFX_DATA(CAboutDlg) 
	enum { IDD = IDD_ABOUTBOX }; 
	//}}AFX_DATA 
 
	//{{AFX_VIRTUAL(CAboutDlg) 
	protected: 
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support 
	//}}AFX_VIRTUAL 
 
protected: 
	//{{AFX_MSG(CAboutDlg) 
	//}}AFX_MSG 
	DECLARE_MESSAGE_MAP() 
}; 
 
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD){} 
 
void CAboutDlg::DoDataExchange(CDataExchange* pDX) 
{	CDialog::DoDataExchange(pDX);  } 
 
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) 
	//{{AFX_MSG_MAP(CAboutDlg) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
BEGIN_MESSAGE_MAP(CThreadCompeteApp, CWinApp) 
	//{{AFX_MSG_MAP(CThreadCompeteApp) 
	ON_COMMAND(ID_APP_ABOUT, OnAppAbout) 
	ON_COMMAND(ID_APP_EXIT, OnAppExit) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
CThreadCompeteApp::CThreadCompeteApp(){} 
 
CThreadCompeteApp theApp; 
 
BOOL CThreadCompeteApp::InitInstance() 
{ 
 
#ifdef _AFXDLL 
	Enable3dControls();			// Call this when using MFC in a shared DLL 
#else 
	Enable3dControlsStatic();	// Call this when linking to MFC statically 
#endif 
 
	SetRegistryKey(_T("Threads Compete Demo Applications")); 
 
	// To create the main window, this code creates a new frame window 
	// object and then sets it as the application's main window object. 
	CMainFrame* pFrame = new CMainFrame; 
	m_pMainWnd = pFrame; 
 
	// create and load the frame with its resources 
	pFrame->LoadFrame(IDR_MAINFRAME,WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL,NULL); 
	pFrame->MoveWindow(50,50,940,640,true); 
 
	// The one and only window has been initialized, so show and update it. 
	pFrame->ShowWindow(SW_SHOW); 
	pFrame->UpdateWindow(); 
	return TRUE; 
} 
 
void CThreadCompeteApp::OnAppAbout() 
{	CAboutDlg aboutDlg;	aboutDlg.DoModal(); } 
 
void CThreadCompeteApp::OnAppExit()  
{	CWinApp::OnAppExit();  
}