Easiest way to embed HTML/CSS/JS content in a Windows (XP +) C++ application?
I have an app written in C++ using Visual Studio 2010 to run on Windows (version XP upwards) as an .EXE. It uses plain Win32 for the existing UI.
I am aware of the WebKit project. However, looking at the binaries available for download it appears to be presented as a stand-alone application, rather than a library that can be linked against a C++ app to allow browser content to displayed.
Can anyone suggest a good way of doing this?
If you're using MFC, Patrick's answer is correct.
If you're not using MFC, you can embed Internet Explorer using "ATL control containment" - see How to add ATL control containment support to any window in Visual C++.
It boils down to linking with the right libraries and then using this one-liner:
// Creates the Web Browser control and navigates to the // specified web page. HWND hWnd = ::CreateWindow("AtlAxWin", "http://www.microsoft.com", WS_CHILD|WS_VISIBLE, 10, 10, 500, 300, hParent, NULL, ::GetModuleHandle(NULL), NULL);
You could try to include the Internet Explorer as a COM component in your application. This is explained on http://msdn.microsoft.com/en-us/library/aa752046(VS.85).aspx.
You could also use the QtWeb library (see http://www.qtweb.net/).