www.pudn.com > 智能内码识别,支持屏幕取词翻译的程序.zip > BASICBUT.CPP


// basicbut.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include	"resource.h" 
#include	"basicwin.h" 
#include "basicbut.h" 
#include	"systemse.h" 
#include	"menubutt.h" 
#include	"activebu.h" 
#include	"cswin.h"     
 
#ifdef _DEBUG 
#undef THIS_FILE 
static char BASED_CODE THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CBasicButton 
 
CBasicButton::CBasicButton() 
{ 
} 
 
CBasicButton::~CBasicButton() 
{ 
//	DestroyWindow() ; 
} 
 
//初始化按钮            initapplication 
BOOL	CBasicButton::InitButton( 	LPCSTR 	lpcsName , 	//窗口名称 
								const RECT &rect ,	//窗口大小 
								CWnd 	*pParent ,	//父窗口 
								UINT	uWinID )	//窗口ID 
{ 
	//创建窗口 
	if( !Create( NULL , lpcsName , WS_CHILD ,  
			rect , pParent , uWinID ) ) 	//创建失败 
		return	0 ; 
					 
	ShowWindow( SW_SHOWNOACTIVATE ) ;	//显示按钮 
	return	1 ; 
} 
 
BEGIN_MESSAGE_MAP(CBasicButton, CBasicWin) 
	//{{AFX_MSG_MAP(CBasicButton) 
	ON_WM_RBUTTONDOWN() 
	ON_WM_RBUTTONUP() 
	ON_WM_MOUSEMOVE() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CBasicButton message handlers 
 
void CBasicButton::OnRButtonDown(UINT nFlags, CPoint point) 
{ 
	// TODO: Add your message handler code here and/or call default 
	CBasicWin::OnRButtonDown(nFlags, point); 
 
	((CCsWin*)GetParent())->ButtonDown( this , point ) ;	//表示按钮按下了 
} 
 
void CBasicButton::OnRButtonUp(UINT nFlags, CPoint point) 
{ 
	// TODO: Add your message handler code here and/or call default 
	CBasicWin::OnRButtonUp(nFlags, point); 
 
	((CCsWin*)GetParent())->ButtonUp() ;	//表示按钮松开了 
} 
 
void CBasicButton::OnMouseMove(UINT nFlags, CPoint point) 
{ 
	// TODO: Add your message handler code here and/or call default 
	((CCsWin*)GetParent())->MoveWindowToNewPos( this , point ) ;	//移动父窗口 
	 
	CBasicWin::OnMouseMove(nFlags, point); 
}