Full CEF based MFC SDI Browser

Built a cool app using CEF that you'd like to share with the community? Talk about it here.

Full CEF based MFC SDI Browser

Postby ScottV » Thu Mar 27, 2014 3:10 pm

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
Last edited by ScottV on Tue Jan 12, 2016 8:36 pm, edited 1 time in total.
ScottV
Techie
 
Posts: 26
Joined: Thu Mar 27, 2014 1:22 pm

Re: Full CEF based MFC SDI Browser

Postby ScottV » Fri Mar 28, 2014 2:58 pm

Here is a screen shot of the browser.

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


--Scott
ScottV
Techie
 
Posts: 26
Joined: Thu Mar 27, 2014 1:22 pm

Re: Full CEF based MFC SDI Browser

Postby mistymorning » Thu May 08, 2014 10:05 am

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 26593 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.
Building a web-browser that does not call home
mistymorning
Techie
 
Posts: 15
Joined: Sun May 04, 2014 8:08 am

Re: Full CEF based MFC SDI Browser

Postby ScottV » Thu Jul 10, 2014 8:18 am

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
Last edited by ScottV on Tue Jan 12, 2016 8:36 pm, edited 1 time in total.
ScottV
Techie
 
Posts: 26
Joined: Thu Mar 27, 2014 1:22 pm

Re: Full CEF based MFC SDI Browser

Postby gslz » Thu Jul 31, 2014 1:13 pm

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;
gslz
Newbie
 
Posts: 1
Joined: Thu Jul 31, 2014 11:30 am

Re: Full CEF based MFC SDI Browser

Postby Cyber » Fri Dec 19, 2014 5:55 pm

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.
Cyber
Newbie
 
Posts: 2
Joined: Tue Dec 16, 2014 4:24 pm

Re: Full CEF based MFC SDI Browser

Postby wizardkp » Wed Aug 19, 2015 6:06 pm

hello,
I tried your browser and it was excellent!

can i have copy of you C# code?


Thanks! :)
wizardkp
Newbie
 
Posts: 1
Joined: Wed Aug 19, 2015 6:02 pm

Re: Full CEF based MFC SDI Browser

Postby meitis1 » Fri Sep 18, 2015 8:44 am

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 ?
meitis1
Newbie
 
Posts: 8
Joined: Tue Sep 15, 2015 3:55 pm

Re: Full CEF based MFC SDI Browser

Postby jjacobson » Mon Dec 21, 2015 2:26 pm

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.
jjacobson
Newbie
 
Posts: 5
Joined: Tue Dec 08, 2015 3:48 pm

Re: Full CEF based MFC SDI Browser

Postby magreenblatt » Tue Dec 29, 2015 12:52 pm

Sounds like the same problem as viewtopic.php?f=6&t=13741
magreenblatt
Site Admin
 
Posts: 9838
Joined: Fri May 29, 2009 6:57 pm

Next

Return to Apps Discussion

Who is online

Users browsing this forum: No registered users and 1 guest