Winforms CefWebBrowser eats windows messages?

Having problems with building or using the CefGlue .NET/Mono binding? Ask your questions here.

Moderator: fddima

Winforms CefWebBrowser eats windows messages?

Postby Desu » Thu Jul 25, 2013 4:25 pm

Hello,

I am trying to catch some windows messages and some keypress events on the form.
f.i.

Code: Select all
private void FormMain_KeyDown(object sender, KeyEventArgs e)
        {
            Console.WriteLine("k"+e.KeyCode);
        }


is not called when there is a cefwebbrowser in the form, but as soon as i remove the browser it works. Checked the CefWebBrowser sample, could not figure out how to solve it?
Do i have to do offscreen rendering and paint a panel for form to not lose focus?
Desu
Techie
 
Posts: 11
Joined: Mon Jun 24, 2013 3:05 pm

Re: Winforms CefWebBrowser eats windows messages?

Postby fddima » Thu Jul 25, 2013 5:08 pm

Under winforms control created actual underlying browser window, which handles any messages. WinForms did not have even bubbling/capturing, so to handle some events in this way, you need subclass wndproc of actual browser's window. Also check cef api handlers around keyboard handling.

About loosing focus - what you mean? Probably better is using single threaded message loop (can be set via cefsettings), in multi-threaded message loop, 'cause windows owned by different threads (maintained by different message loops) - you will got unexpected results with some winforms controls (it's not CEF/CefGlue problem, it is WinForms problem).
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: Winforms CefWebBrowser eats windows messages?

Postby Desu » Sun Jul 28, 2013 3:48 pm

okay thanks. overridden actual window's wndproc.
Desu
Techie
 
Posts: 11
Joined: Mon Jun 24, 2013 3:05 pm


Return to CefGlue Forum

Who is online

Users browsing this forum: No registered users and 19 guests