CefGlue in an Office VSTO Addin (COM environment)

927 views
Skip to first unread message

Roded Bahat

unread,
May 24, 2014, 1:05:38 PM5/24/14
to cef...@googlegroups.com
Hello,
I'm quite new to Xilium.CefGlue, and I'm having some problems I hope someone has already solved.

My objective is to be able to incorporate it in a VSTO Word addin.

I'm currently using ThisAddin's Startup & Shutdown (which are part of the addin's lifecycle) events to initialize and shutdown CefGlue respectively.
Using the default CefGlue settings (SingleProcess = false, MultiThreadedMessageLoop = true) CefGlue works just fine. However when calling CefRuntime.Initialize() Word opens a persistent splash screen for the duration of the application's run (process explorer shows another opened winword.exe process was created).
Changing the SingleProcess setting to true, eliminates the redundant splash screen and process. In that case though, the CefGlue CefWebBrowser control is not drawn (whatever value MultiThreadedMessageLoop is set to).
This obviously has to do with threads (and also COM apartments?).

Has anyone encountered such an issue?
Any tips in general on using CefGlue from a VSTO addin or specifically in a COM environment would be much appreciated.

Many thanks,
Roded

Dmitry Azaraev

unread,
May 25, 2014, 2:54:46 PM5/25/14
to cef...@googlegroups.com
Hello.

For first - CEF should be initalized only once per process. (ThisAddin Startup/Shudown probably can be called more than once, i'm not sure).

Second thing - you should look into CefSettings struct - it has browser subprocess path. You should provide own subprocess, 'cause in your's case it try execute word.exe, that of course incorrect). You can create own subprocess (it is also calls CefRuntime.Initialize / etc, look in sources, or try use cefclient.exe for example.
Also it is good idea to create minimal sample project what can be published as sample / can be used to debug problems.

And finally - there is not depends from COM apartments.

Also, i'm successfully integrate CEF into outlook by use browser out-of-process idea. I.e. when adding starts helper process, and helper process becomes actually process what executes CEF/browser. Later browser window reparented inside required view. This is more complex solution, but potentically can be more reliable solution.




--
You received this message because you are subscribed to the Google Groups "CefGlue" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cefglue+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Best regards,
   Dmitry

Roded Bahat

unread,
Jun 1, 2014, 9:16:30 AM6/1/14
to cef...@googlegroups.com, dmitry....@gmail.com
Thanks for the reply Dmitry.
I'll look into it.
Perhaps I should be reading the CEF docs.

Nguyễn Việt Trung

unread,
Feb 9, 2015, 2:54:03 AM2/9/15
to cef...@googlegroups.com, dmitry....@gmail.com
Hello Dmitry, 
would you kindly post a code example of your implementation? I have tried many different ways with CefGlue and CefSharp but nothing worked...

Roded Bahat

unread,
Sep 12, 2015, 7:18:01 AM9/12/15
to CefGlue, dmitry....@gmail.com
Revisiting this.
If anyone has any info, or better yet, an example to the "browser out-of-process idea" Dimitry mentioned, it would be much appreciated.
Thanks.

Dmitry Azaraev

unread,
Sep 12, 2015, 7:31:52 AM9/12/15
to Roded Bahat, CefGlue

@Roded, I'm have 2-3 closed implementations of this, so sorry, can't share sample. If you explain what exactly you problem, I'm probably can write some pointers about. If you just have problem with IPC  - you can try chromiumfx instead of cefglue (it is as I'm understand support this out-of-box). I'm never touch it, so nothing can add. Final implementation vary on needs. While CEF is framework - it is sometimes not so easy integrates into existing apps, by chromium architecture. At my last attempt I'm still use cefglue, but completely strip from ugly UI stacks like WinForms or WPF from CEF-hosting process. Yes, both of them broken, and sometimes just not work (but for usual cases it is not issues). So... At this moment this task require lot of work. But it is can be completed in finite time.

Roded Bahat

unread,
Sep 16, 2015, 3:25:42 AM9/16/15
to CefGlue, rod...@gmail.com, dmitry....@gmail.com
@Dmitry, thanks for the reply.
I managed to get it working with Chromiumfx without too much trouble.
Thanks!

Arsalan Younus

unread,
Apr 19, 2017, 12:43:44 PM4/19/17
to CefGlue
Hey Roded,

Can you please share a sample of code in which you used chromiumfx?

I am stuck where I initialize ChromiumBrowser my win app gets closed immediately.

Thanks
Reply all
Reply to author
Forward
0 new messages