Пример #1
0
bool simply_msg_single_click(SimplyMsg *self, ButtonId button) {
  return send_click(self, CommandClick, button);
}
Пример #2
0
bool simply_msg_long_click(SimplyMsg *self, ButtonId button) {
  return send_click(self, CommandLongClick, button);
}
Пример #3
0
LRESULT CALLBACK 
mouse_message(int nCode, WPARAM wParam, LPARAM lParam)
{
    if (nCode == HC_ACTION)
    {
        /* 忽略多余控件产生的鼠标消息 */
        static bool m_ingore = false;
        /* 当鼠标在同一区域移动时,不产生多余的开销 */
        static bool b_track = true;
        MSG* msg = (MSG*)lParam;
        if ((msg->message == WM_MOUSEMOVE) && b_track)
        {
            b_track =  false;
            m_ingore = false;
            TRACKMOUSEEVENT MouseEvent;
            MouseEvent.cbSize = sizeof(TRACKMOUSEEVENT);
            MouseEvent.dwFlags = TME_HOVER | TME_LEAVE;
            MouseEvent.hwndTrack = WindowFromPoint(msg->pt);
            if (mouse_time)
            {
                MouseEvent.dwHoverTime = (DWORD)mouse_time;
            }
            else
            {
                MouseEvent.dwHoverTime = HOVER_DEFAULT;
            }
            TrackMouseEvent(&MouseEvent);
            Sleep(0);
            return CallNextHookEx(message_hook, nCode, wParam, lParam);
        }
        switch (msg->message)
        {
        case WM_MOUSEHOVER:
            if (!(activation || mouse_close))
            {
                break;
            }
            if (!m_ingore)
            {
                RECT rc, rc_t;
                int active = 1;
                if (mouse_on_tab(&rc, &msg->pt, &active))
                {
                    bool in;
                    rc_t = rc;
                    rc_t.right -= 28;
                    in = PtInRect(&rc_t, msg->pt);
                    if ((activation && !active && in) || (mouse_close && !in))
                    {
                    #ifdef _LOGDEBUG
                        logmsg("mouse on tab, send click message!\n");
                    #endif
                        send_click(MOUSEEVENTF_LEFTDOWN);
                    }
                }
            }
            m_ingore = true;
            b_track = true;
            break;
        case WM_LBUTTONDBLCLK:
            if (!m_ingore && double_click)
            {
            #ifdef _LOGDEBUG
                logmsg("WM_LBUTTONDBLCLK received!\n");
            #endif
                RECT rc;
                if (mouse_on_tab(&rc, &msg->pt, NULL))
                {
                    send_click(MOUSEEVENTF_MIDDLEDOWN);
                }
                m_ingore = true;
            }
            b_track = true;
            break;
        case WM_LBUTTONUP:
            m_ingore = true;
            b_track =  true;
            break;
        case WM_MOUSELEAVE:
            m_ingore = true;
            b_track =  true;
            break;
        default :
            break;
        }
    }
    return CallNextHookEx(message_hook, nCode, wParam, lParam);
}