LRESULT __stdcall DefWindowProc1(HWND hWnd,UINT Msg,WPARAM wParam, LPARAM lParam )
{
CPoint pt;
CDrawButton *pButton=(CDrawButton*)GetWindowLong(hWnd,GWL_USERDATA); //获得窗口信息
switch (Msg)
{
case WM_LBUTTONDBLCLK: //屏蔽双击事件
{
return TRUE;
break;
}
case WM_PAINT: //绘制窗口事件
{
if (pButton->m_Style>0)
return pButton->OnPaint( hWnd);
else
return CallWindowProc(pButton->m_OldProc, hWnd,Msg,wParam,lParam);
break;
}
case WM_LBUTTONDOWN: //鼠标左键按下事件
{
pt.x = LOWORD(lParam); //鼠标按下的横坐标
pt.y = HIWORD(lParam); //鼠标按下的纵坐标
if (pButton->m_Style>0)
return pButton->OnLButtonDown( hWnd, 0, pt );
else
return CallWindowProc(pButton->m_OldProc, hWnd,Msg,wParam,lParam);
break;
}
case WM_LBUTTONUP: //鼠标左键抬起事件
{
pt.x = LOWORD(lParam); //鼠标按下的横坐标
pt.y = HIWORD(lParam); //鼠标按下的纵坐标
if (pButton->m_Style>0)
return pButton->OnLButtonUp( hWnd, 0,pt );
else
return CallWindowProc(pButton->m_OldProc, hWnd,Msg,wParam,lParam);
break;
}