我用CreateWindowEx(),创建了一个系统预先设定的"button"类的Button,这个Button可以像窗口那样接收到WM_MOUSEMOVE和WM_KEYDOWN这样的消息吗??我试了,根本就接收不到,有什么方法吗??
如果实在不行,那怎么用CreateWindowEx()和自己的窗口类来创建一个和系统预先定义的"button"类一样的外观。
thanx advance

解决方案 »

  1.   

    The WM_MOUSEMOVE message is posted to a window when the cursor moves. If the mouse is not captured, the message is posted to the window that contains the cursor. Otherwise, the message is posted to the window that has captured the mouse.The WM_MOUSELEAVE message is posted to a window when the cursor leaves the client area of the window specified in a prior call to TrackMouseEvent.
      

  2.   

    当然不是GetMessage的事情,重载PreTranslateMessage就可以了
      

  3.   

    在PreTranslateMessage里面
    收到鼠标移动消息以后判断鼠标是不是在按牛区域。
    收到按键消息判断单前当前当前焦点是不是按牛
    ::GetFocus() == GetDlgItem(IDC_BUTTON1)->GetSafeHwnd()
      

  4.   

    WM_MOUSEMOVEH是可以用的,xp风格的字定义按钮就用了那种,
    在你的头文件前添加
    extern "C" WINUSERAPI BOOL WINAPI TrackMouseEvent(LPTRACKMOUSEEVENT lpEventTrack);试试