Detect mouse click event (3.1180.719)

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Detect mouse click event (3.1180.719)

Postby CantStop0708 » Wed Mar 06, 2013 8:17 am

How to detect and process mouse click event on CEF (v.3.1180.719)?
WM_LBUTTONDOWN and WM_LBUTTONUP messages doesn't work at "cefclient_win.cpp".
CantStop0708
Mentor
 
Posts: 60
Joined: Mon Jan 21, 2013 4:10 am

Re: Detect mouse click event (3.1180.719)

Postby magreenblatt » Wed Mar 06, 2013 11:51 am

What are you trying to do with the mouse click event?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Detect mouse click event (3.1180.719)

Postby CantStop0708 » Thu Mar 07, 2013 1:46 am

I'm trying to save the coordinates of mouse cursor.
I've already found the way to track ckick event. I'm using SetWindowsHookEx().
Here is the code:
Code: Select all
HHOOK hMouseHook;
LRESULT CALLBACK OnMouseEvent(int nCode, WPARAM wParam, LPARAM lParam);

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    //........
   
    switch (message)
    {
        case WM_CREATE:
        {
            //........
            hMouseHook = SetWindowsHookEx(WH_MOUSE_LL, OnMouseEvent, hInst, 0);
        }
        //........
    }
}


LRESULT CALLBACK OnMouseEvent(int nCode, WPARAM wParam, LPARAM lParam)
{
    if (wParam == WM_LBUTTONDOWN)
    {
        // do stuff (for example save mouse cursor coordinates)
    }
   
    return CallNextHookEx(hMouseHook, nCode, wParam, lParam);
}
CantStop0708
Mentor
 
Posts: 60
Joined: Mon Jan 21, 2013 4:10 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 225 guests