Page 1 of 2

Full CEF based MFC SDI Browser

PostPosted: Thu Mar 27, 2014 3:10 pm
by ScottV
For those who want to use CEF in MFC, here is an example we created of a fully working CEF based web browser, which includes pop-up window support, in an MFC SDI application.

https://bitbucket.org/TSS_DEV/cef-mfc

We appreciate any comments or suggestions which could make the CEF-MFC better.

--Scott

Re: Full CEF based MFC SDI Browser

PostPosted: Fri Mar 28, 2014 2:58 pm
by ScottV
Here is a screen shot of the browser.

CEFMFC.png
Screen Shot
CEFMFC.png (128.21 KiB) Viewed 30545 times


--Scott

Re: Full CEF based MFC SDI Browser

PostPosted: Thu May 08, 2014 10:05 am
by mistymorning
I like the big buttons, simple and quick to use but I went for small ones because I used a tools-trip and it soon gets filled up with bookmark folders and buttons

MM.png
MM.png (88.85 KiB) Viewed 30412 times


The big icon on the right flashes whilst pages are loading and you can click the fav icons to close each tab but the best thing is it has an inbuilt tracking protection list that does more than blocking because by default I block all SSL unless the domain has an allow rule and then sites I don't like but cannot block without breaking pages I use "Protected" rules to mess up the user-agent, proxy-for and country codes and then I have the usual Ghostery type blocking.

Save As... does not work for all images but download seems OK but the block I am stuck on is getting any type of extension to work because I don't have a clue about what I should be loading

edit to add:

I have just about got to the stage where I have something worth releasing if anyone wants to play and to give me a little bit of feed-back
http://mistymorning.hostingsiteforfree.com/Browser.html
Download link at the bottom of the page and if you ask me nice then I might even give you a copy of the C# code.

Re: Full CEF based MFC SDI Browser

PostPosted: Thu Jul 10, 2014 8:18 am
by ScottV
I updated the example CEF-MCF browser to correctly address popup windows and destroying the browser when the popup window is closed.

https://bitbucket.org/TSS_DEV/cef-mfc

--Scott

Re: Full CEF based MFC SDI Browser

PostPosted: Thu Jul 31, 2014 1:13 pm
by gslz
Hi Scott,

I've been trying to build up the CEFMFC project in VS2012 after following the instructions on the Google Code page, but I'm getting a linker error for libcef.lib. The dll wrapper is from the Win32 trunk build of CEF -- should I use a release build?

What I did

1. Got the CEFMFC project from Code
2. Added environment variable to system PATH
3. Opened the CEFMFC soln
4. Added the libcef_dll_wrapper project to the solution
5. Built the libcef_dll_wrapper
6. Changed the platform toolset on CEFMFC to 110
7. Built CEFMFC

And I get a fatal error from VS saying it can't open libcef.lib. Full disclosure - I am a student with little VS experience, so it's probably some exceptionally stupid VS configuration error, but nonetheless;

Re: Full CEF based MFC SDI Browser

PostPosted: Fri Dec 19, 2014 5:55 pm
by Cyber
I liked this code and have used it to create a tabbed multi-browser MDI version (this is an SDI) and have it working pretty well. One website that kills my app and also your app is www.instapundit.com, I think it has to do with ads but after a few seconds it will crash the browser. The CEFClient sample app does not crash but it does display a warning that Console Logging is about to commence (something I had not seen before until trying that site.)

Anyway, one thing I have ran into is that when I get a popup I need to use their default handling for now (just return false without doing anything) because when I try to do something with their window information and create a new tab I get a deadlock. Not sure why, could be that my UI thread for all the tabs is a single thread. Other than that it works great. Just mentioning this for those who use this as a starting point for an MDI tabbed app.

Re: Full CEF based MFC SDI Browser

PostPosted: Wed Aug 19, 2015 6:06 pm
by wizardkp
hello,
I tried your browser and it was excellent!

can i have copy of you C# code?


Thanks! :)

Re: Full CEF based MFC SDI Browser

PostPosted: Fri Sep 18, 2015 8:44 am
by meitis1
I have converted your MFC project into VS2013 and all worked fine.
I then used cef "Windows 32bit 2015-04-01 CEF 3.2171.2069 (65MB) - Chromium 39.0.2171.95" and
all worked fine with this code (basically unchanged I only added nullptr for needed but optional parameters):

//Initialize CEF
bool bSucceeded = CefInitialize(mainArgs, appSettings, cefApplication, nullptr);

if (bSucceeded)
{
CefRefPtr<CefRequestContext> cefRequestContext;
CefBrowserHost::CreateBrowser(info, m_Handler, _T("http://www.google.com/"), browserSettings, cefRequestContext);
}
But when I was exiting it crashed.

Then I used cef "Windows 32bit 2015-09-05 CEF 3.2454.1320.g807de3c (73MB) - Chromium 45.0.2454.85" and it worked but when I was exiting it crashed.
Here is the stack:
libcef.dll!base::debug::BreakDebugger() Line 21 C++
> libcef.dll!logging::LogMessage::~LogMessage() Line 642 C++
libcef.dll!CefBrowserMainParts::PostMainMessageLoopRun() Line 190 C++
libcef.dll!content::BrowserMainLoop::ShutdownThreadsAndCleanUp() Line 910 C++
libcef.dll!content::BrowserMainRunnerImpl::Shutdown() Line 257 C++
libcef.dll!`anonymous namespace'::CefUIThread::CleanUp() Line 271 C++
libcef.dll!base::Thread::ThreadMain() Line 256 C++
libcef.dll!base::`anonymous namespace'::ThreadFunc(void * params=0x00ae5aa8) Line 84 C++
kernel32.dll!@BaseThreadInitThunk@12() Unknown
ntdll.dll!RtlInitializeExceptionChain() + 143 bytes Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
ntdll.dll!RtlInitializeExceptionChain() + 90 bytes Unknown

Could anyone help ?

Re: Full CEF based MFC SDI Browser

PostPosted: Mon Dec 21, 2015 2:26 pm
by jjacobson
I'm getting the exact same crash call stack in my MFC MDI app as well. currently running the latest CEF3 2526.1364.

it crashes when calling CefShutodown only in Debug. running in Release, or running in single_process mode does not crash.

Re: Full CEF based MFC SDI Browser

PostPosted: Tue Dec 29, 2015 12:52 pm
by magreenblatt
Sounds like the same problem as viewtopic.php?f=6&t=13741