Thursday, August 7, 2014

How to use Webkit CEF in an MFC Project

It took sometime before i was able to figure this out myself.

The CEF download contains a sample on how it’s done in a Win32 Project, in Visual Studio. Unfortunately, that sample contains quite a lot of things that makes it difficult to grasp especially for those who have completely no prior knowledge of using webkit (which was my case).

Okay some might ask why use CEF in an MFC app in the first place. Well, i needed it for a project i was assigned at work. 


image

There are very little sources out there about using CEF in an MFC project. Actually, i've found just a single blog post regarding this – the rest were bits and pieces of info and forum replies. Well, i guess not many people are using CEF+MFC but it is the combination that was perfect to my current needs.

Note: MFC does not natively have HDPI support. On the other hand, i think, a Win32 Project has some bit of processing regarding this. I’m using Visual Studio 2010, btw.

Also, I’m making this post a bit of a spoon-fed tutorial. Just follow along the steps if you’ve never used webkit/CEF before. Or if you already have an idea on how to do it, just skip the steps here and download the sample project which you can probably use as a template or your reference project.