Could not catch the WM_LBUTTONUP on a CEF instance

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.

Could not catch the WM_LBUTTONUP on a CEF instance

Postby jianmingt » Mon Jan 20, 2014 3:58 pm

1) create a subclasswindow for a CEF browser, called CChromiumBrowser.
2) catch the CEF browser mouse event in BOOL CChromiumBrowser::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)

I could catch WM_MOUSEMOVE and WM_LBUTTONDOWN but not WM_LBUTTONUP. I guess CEF blocks WM_LBUTTONDOWN.
show release symbols below. Thanks

> EmbStudio.exe!CChromiumBrowser::OnWndMsg(unsigned int message, unsigned int wParam, long lParam, long * pResult) Line 121 C++
EmbStudio.exe!CWnd::WindowProc(unsigned int message, unsigned int wParam, long lParam) Line 2137 C++
EmbStudio.exe!AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Line 293 C++
EmbStudio.exe!AfxWndProc(HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Line 452 C++
user32.dll!gapfnScSendMessage() + 818 bytes Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]
user32.dll!GetThreadDesktop() + 215 bytes Unknown
user32.dll!GetThreadDesktop() + 134 bytes Unknown
user32.dll!GetWindow() + 1008 bytes Unknown
user32.dll!SendMessageW() + 76 bytes Unknown
libcef.dll!content::RenderWidgetHostViewWin::OnMouseEvent(unsigned int message, unsigned int wparam, long lparam, int & handled) Line 1885 C++
libcef.dll!content::RenderWidgetHostViewWin::ProcessWindowMessage(HWND__ * hWnd, unsigned int uMsg, unsigned int wParam, long lParam, long & lResult, unsigned long dwMsgMapID) Line 122 C++
libcef.dll!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1174405120,0> >::WindowProc(HWND__ * hWnd, unsigned int uMsg, unsigned int wParam, long lParam) Line 3508 C++
user32.dll!gapfnScSendMessage() + 818 bytes Unknown
user32.dll!GetThreadDesktop() + 215 bytes Unknown
user32.dll!GetThreadDesktop() + 134 bytes Unknown
user32.dll!CharPrevW() + 312 bytes Unknown
user32.dll!GetLastActivePopup() + 341 bytes Unknown
libcef.dll!base::MessagePumpForUI::ProcessMessageHelper(const tagMSG & msg) Line 409 C++
libcef.dll!base::MessagePumpForUI::ProcessPumpReplacementMessage() Line 453 C++
libcef.dll!base::MessagePumpForUI::ProcessMessageHelper(const tagMSG & msg) Line 392 C++
libcef.dll!base::MessagePumpForUI::DoRunLoop() Line 239 C++
libcef.dll!base::MessagePumpWin::Run(base::MessagePump::Delegate * delegate) Line 48 C++
libcef.dll!base::MessageLoop::RunInternal() Line 441 C++
libcef.dll!base::RunLoop::Run() Line 46 C++
libcef.dll!base::MessageLoop::Run() Line 322 C++
libcef.dll!base::Thread::Run(base::MessageLoop * message_loop) Line 159 C++
libcef.dll!base::Thread::ThreadMain() Line 207 C++
libcef.dll!base::`anonymous namespace'::ThreadFunc(void * params) Line 78 C++
kernel32.dll!BaseThreadInitThunk() + 18 bytes Unknown
ntdll.dll!RtlInitializeExceptionChain() + 99 bytes Unknown
ntdll.dll!RtlInitializeExceptionChain() + 54 bytes Unknown
jianmingt
Techie
 
Posts: 20
Joined: Fri Oct 25, 2013 7:08 pm

Re: Could not catch the WM_LBUTTONUP on a CEF instance

Postby magreenblatt » Tue Jan 21, 2014 11:23 pm

Did you have a question?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Could not catch the WM_LBUTTONUP on a CEF instance

Postby jianmingt » Wed Jan 22, 2014 1:20 pm

yes, magreenblatt. see the attached image.
see step 3, i could not catch mouseleftbuttonup event, so there is no way to tell app to terminate selection.
i have a routine CChromiumBrowser::OnWndMsg for processing CEF instance mouse event.
1) when press mouse on CEF instance, message == WM_LBUTTONDOWN is true
2) when move mouse on CEF instance, message == WM_MOUSEMOVE is true
3) but, when release mouse on CEF instance, message == WM_LBUTTONUP is never true or WM_LBUTTONUP is filtered by RenderWidgetHostViewWin::OnMouseEvent.

BOOL CChromiumBrowser::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
//pseudo code below
if(message == WM_LBUTTONUP)
{....
}
else if(message == WM_LBUTTONDOWN)
{....
}
else if(message == WM_MOUSEMOVE)
{....
}
else
{
}

}
Attachments
1.png
1.png (1.15 MiB) Viewed 9306 times
jianmingt
Techie
 
Posts: 20
Joined: Fri Oct 25, 2013 7:08 pm

Re: Could not catch the WM_LBUTTONUP on a CEF instance

Postby magreenblatt » Wed Jan 22, 2014 3:31 pm

What is your purpose in subclassing the window? Chromium uses mouse capture which may explain why you're not seeing the WM_LBUTTONUP event.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Could not catch the WM_LBUTTONUP on a CEF instance

Postby jianmingt » Wed Jan 22, 2014 5:12 pm

Chromium is a child window. after subclassing the chromium window, i can catch its window mouse events and post to its parent window.
jianmingt
Techie
 
Posts: 20
Joined: Fri Oct 25, 2013 7:08 pm

Re: Could not catch the WM_LBUTTONUP on a CEF instance

Postby fasecero » Mon Jun 27, 2016 6:25 pm

So, subclassing the window is the only way to go? I need to get these browser mouse events (down, move, up). OnPreKeyEvent works only for keyboard events.
fasecero
Mentor
 
Posts: 60
Joined: Mon May 12, 2014 2:53 pm

Re: Could not catch the WM_LBUTTONUP on a CEF instance

Postby fasecero » Tue Jun 28, 2016 4:12 pm

Problem solved subclassing the following window:

Code: Select all
HWND b_hwnd = browser->GetHost()->GetWindowHandle();
HWND hwnd = GetWindow(b_hwnd, GW_CHILD);

SetWindowSubclass(hwnd, ...
fasecero
Mentor
 
Posts: 60
Joined: Mon May 12, 2014 2:53 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 84 guests