GithubHelp home page GithubHelp logo

simplecefdll's Introduction

Simple CEF( Chromium Embedded Framework ) DLL

This DLL can be used to embed an instance of Chromium browser in a window of your application. Is written in C++ in Win32. Has been tested in Windows XP( 32 bits ) and in Windows 8.1( 64 bits ). Has been embedded in two applications written with Visual Studio C++ 2010 and C++ Builder 2009.

How to use

The DLL exports four functions:

  1. void SimpleCEFDLL_Initialize( HINSTANCE hInstance );
  2. void SimpleCEFDLL_CreateBrowser( HWND hWnd, const wchar_t* url );
  3. void SimpleCEFDLL_ResizeBrowser( HWND hWnd );
  4. void SimpleCEFDLL_Shutdown( bool terminate );

How to use with Visual Studio C++ 2010

You can see the example application Test_SimpleCEFDLL in this repository.

How to use with C++ Builder 2009

  1. You first must typedef de prototypes of your functions:
typedef void (*SimpleCEFDLL_Initialize)(HINSTANCE);
typedef void (*SimpleCEFDLL_CreateBrowser)(HWND,const wchar_t*);
typedef void (*SimpleCEFDLL_ResizeBrowser)(HWND);
typedef void (*SimpleCEFDLL_Shutdown)(bool);
  1. In the WinMain entry you can write:
Application->Initialize();

HINSTANCE hDLL = LoadLibrary("SimpleCEFDLL.dll");
SimpleCEFDLL_Initialize fnInitialize = (SimpleCEFDLL_Initialize)GetProcAddress((HMODULE)hDLL, 
																				"SimpleCEFDLL_Initialize");
SimpleCEFDLL_Shutdown fnShutdown = (SimpleCEFDLL_Shutdown)GetProcAddress((HMODULE)hDLL, "SimpleCEFDLL_Shutdown");

(*fnInitialize)(GetModuleHandle(NULL));

Application->MainFormOnTaskBar = true;
Application->CreateForm(__classid(TForm1), &Form1);

Application->Run();

(*fnShutdown)(true);
  1. Now in the TFormBrowser that you want to show the browser embedded:
void __fastcall TFormBrowser::FormCreate(TObject *Sender)
{
	HINSTANCE hDLL = LoadLibrary("SimpleCEFDLL.dll");
	SimpleCEFDLL_CreateBrowser fnCreateBrowser = (SimpleCEFDLL_CreateBrowser)GetProcAddress((HMODULE)hDLL, 
																				"SimpleCEFDLL_CreateBrowser");
	
	//This pointer to function can be a member of TFormBrowser
	m_fnResizeBrowser = (SimpleCEFDLL_ResizeBrowser)GetProcAddress((HMODULE)hDLL, "SimpleCEFDLL_ResizeBrowser");
	
	String url( "http://www.google.es" );
	(*fnCreateBrowser)(Handle, url.c_str() );
}

void __fastcall TFormBrowser::FormResize(TObject *Sender)
{
	(*m_fnResizeBrowser)(Handle);
}

How to build de DLL

If you want you can go directly to the step 4.

  1. Download cef_binary_3.1650.1461_windows32.7z from https://cefbuilds.com/. Is a revision of the trunk from 2013-10-16 for Windows 32 bits.
  2. Extract and open the solution cefClient2010.sln with Visual Studio C++ 2010 Express.
  3. Build the project libcef_dll_wrapper. It will generate libcef_dll_wrapper.lib that is included in this repository.
  4. Download or clone this repository.
  5. Build the solution SimpleCEFDLL.sln. It will generate SimpleCEFDLL.dll and Test_SimpleCEFDLL.dll that shows how to use the DLL.
  6. You must copy with the DLL:
    • Directory locales
    • cef.pak
    • devtools_resources.pak
    • The rest of DLLs.

Linker options necessaries to build de DLL

  1. /NODEFAULTLIB:LIBCMTD
  2. /FORCE:MULTIPLE

simplecefdll's People

Contributors

lmspgh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.