case WM_MOUSEMOVE: //鼠標移動事件
{
pt.x = LOWORD(lParam); //鼠標按下的橫坐標
pt.y = HIWORD(lParam); //鼠標按下的縱坐標
if (pButton->m_Style>0)
return pButton->OnMouseMove(hWnd,0, pt);
else
return CallWindowProc(pButton->m_OldProc, hWnd,Msg,wParam,lParam);
break;
}
case WM_DESTROY: //銷毀窗口
{
WNDPROC procOld=pButton->m_OldProc;
SetWindowLong(hWnd,GWL_WNDPROC,(long)procOld); //恢復原來的窗口函數(shù)
CWnd* pWnd = ::CWnd::FromHandle(hWnd); //將按鈕對象與控制塊分離
if (pWnd)
{
pWnd->Detach();
}
pButton->m_Flag = 1;
return 1;
}
default :
{
break;
}
}
return CallWindowProc(pButton->m_OldProc, hWnd, Msg, wParam, lParam );