www.pudn.com > GameEngine_src.rar > CMenu.cpp


#include "CMenu.h" 
#include "resource.h" 
#include "BaseUtil.h" 
#include "CEasyDraw.h" 
 
extern CEasyDraw * g_pEasyDraw; 
 
 
const char szTXGFilter[] = "TXG Files (*.TXG)\0*.txg\0"; 
 
 
CMenu::CMenu() 
{ 
	m_iTemplate = IDR_MENU1; 
} 
 
CMenu::~CMenu() 
{ 
 
} 
 
bool CMenu::Init(  HWND hwnd, HINSTANCE hInstance ) 
{ 
	if ( m_hmenu == NULL && m_iTemplate != 0 ) 
	{ 
		m_hmenu = LoadMenu( hInstance, MAKEINTRESOURCE( m_iTemplate ) ); 
		if ( m_hmenu == NULL ) 
			return false; 
 
		return true; 
	} 
 
	return false; 
} 
 
bool CMenu::HandleMsg( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) 
{ 
	switch ( wParam ) 
	{ 
	//"ÎļþÑ¡Ïî" 
	case MU_EXIT: 
		PostMessage( hwnd, WM_CLOSE, 0, 0 ); 
		break; 
	} 
	return true; 
} 
 
void CMenu::Free() 
{ 
	if ( m_hmenu != NULL ) 
	{ 
		DestroyMenu( m_hmenu ); 
		m_hmenu = NULL; 
	} 
}