Two questions when use CEFSharp

408 views
Skip to first unread message

Albert Pan

unread,
Jan 22, 2015, 9:59:43 PM1/22/15
to cefs...@googlegroups.com
I am the beginner of the CEF, and lack the message on CEF, below are some questions:
  1. We want to use CEFSharp as the container and do not need the tab ability. According to the CEF sharp it needs the CefSharp.BrowserSubprocess. Is it possible that we use CEF but do not need the CefSharp.BrowserSubprocess?
  2. We use MEF in out application, and create a container for CEFSharp, and when close the application, there will be an exception: The calling thread cannot access this object because a different thread owns it.

Alex Maitland

unread,
Jan 24, 2015, 12:17:53 AM1/24/15
to cefs...@googlegroups.com

1. The BrowserSubProcess is responsible for the rendering/gpu acceleration, it is a required component.
2. Having never used MEF I can only make the suggestion that you manually call `Cef.Shutdown()` on the same thread on which you created the browser instance.

https://github.com/cefsharp/CefSharp/blob/master/CefSharp.Core/Cef.h#L333

Albert Pan

unread,
Jan 25, 2015, 7:50:15 PM1/25/15
to cefs...@googlegroups.com
Thanks Alex, I try the Cef.Shutdown(), but does not work. And I will re-try this with other way.

在 2015年1月24日星期六 UTC+8下午1:17:53,Alex Maitland写道:

Alex Maitland

unread,
Jan 26, 2015, 5:51:28 AM1/26/15
to cefs...@googlegroups.com

Are you explicitly calling `Cef.Initialize()`? If so then is it the same thread your calling `Cef.Shutdown()`?

Are you using `WPF` or `WinForms`?

Albert Pan

unread,
Jan 26, 2015, 10:16:45 PM1/26/15
to cefs...@googlegroups.com
I am using the WPF. And I call the CEF.Initialize() in the constructor of the control I created and call the Cef.Shutdown() in the dispose method. I will check the thread.

在 2015年1月26日星期一 UTC+8下午6:51:28,Alex Maitland写道:

Albert Pan

unread,
Jan 27, 2015, 1:12:33 AM1/27/15
to cefs...@googlegroups.com
Fix this issue by change the time the initialize and showdown called.


在 2015年1月26日星期一 UTC+8下午6:51:28,Alex Maitland写道:

Alex Maitland

unread,
Jan 27, 2015, 3:37:15 AM1/27/15
to cefs...@googlegroups.com
Excellent! Are you able to provide any more detail? Small code sample perhaps? Just some if someone else has the same problem the information to resolve the issue is readily available.

Thanks!

dirk_...@gmx.de

unread,
Jan 28, 2015, 2:46:10 PM1/28/15
to cefs...@googlegroups.com
Hi,

I am also looking into using CefSharp in WPF. With MEF would be a plus for me. Would you be able to post a sample project or send me sample code that could be stored on GitHUB? I would appreciate that very much...

Albert Pan

unread,
Feb 5, 2015, 10:05:08 PM2/5/15
to cefs...@googlegroups.com
Hi All, not reply on time. I will write a sample on how I use the CEF with MEF in WPF but need some delay. Here are some key point:
  • Make sure the initialize and shutdown in the same thread.
  • make sure shutdown when the controller unloaded.


在 2015年1月29日星期四 UTC+8上午3:46:10,dirk_...@gmx.de写道:

dirk_...@gmx.de

unread,
Feb 11, 2015, 5:01:37 PM2/11/15
to cefs...@googlegroups.com
I have put some beginner CefSharp samples here:
https://github.com/Dirkster99/KB

Please review and let me know if you see issues. Thanks
Reply all
Reply to author
Forward
0 new messages