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: //鼠標(biāo)左鍵按下事件
{
pt.x = LOWORD(lParam); //鼠標(biāo)按下的橫坐標(biāo)
pt.y = HIWORD(lParam); //鼠標(biāo)按下的縱坐標(biāo)
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: //鼠標(biāo)左鍵抬起事件
{
pt.x = LOWORD(lParam); //鼠標(biāo)按下的橫坐標(biāo)
pt.y = HIWORD(lParam); //鼠標(biāo)按下的縱坐標(biāo)
if (pButton->m_Style>0)
return pButton->OnLButtonUp( hWnd, 0,pt );
else
return CallWindowProc(pButton->m_OldProc, hWnd,Msg,wParam,lParam);
break;
}