}
MySelfWnd::~MySelfWnd()
{
}
IMPLEMENT_DYNCREATE(MySelfWnd, CWnd)
BEGIN_MESSAGE_MAP(MySelfWnd, CWnd)
//{{AFX_MSG_MAP(MySelfWnd)
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
ON_MESSAGE (UM_VLISA,PopVlisa)
ON_MESSAGE (UM_PARAM,OnmsgParam)
END_MESSAGE_MAP()
void MySelfWnd::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
MessageBox("你点击了自封装的控件");
// 发送自定义消息,用自定义的无参数的函数处理UM_VLISA消息。
PostMessage(UM_VLISA);
PostMessage(UM_PARAM,321,987);
CWnd::OnLButtonDown(nFlags, point);
}
BOOL MySelfWnd::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
lpszClassName=AfxRegisterWndClass( CS_HREDRAW | CS_VREDRAW , AfxGetApp()->LoadStandardCursor(IDC_ARROW),
(HBRUSH)GetStockObject(LTGRAY_BRUSH), NULL) ;
return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}
void MySelfWnd::PopVlisa()
{
MessageBox("Vlisa");
}
//unsigned int,long WPARAM wParam, LPARAM lParam
void MySelfWnd::OnmsgParam(WPARAM wParam, LPARAM lParam )
{
int i=0;
char szBuffer[10];
i=(int)wParam;
sprintf(szBuffer,"%i",i);
MessageBox(szBuffer);
}