資源簡介
在win32程序中使用Libcef嵌入瀏覽器控件,libcef基于最新chrome內(nèi)核,無IE兼容性問題,你值得擁有。源碼中包含了cef的使用:初始化、回調(diào)設(shè)置、JS與C++交互等,適合初學(xué)者學(xué)習(xí)。(VS2008工程)
代碼片段和文件信息
//?CefDemo.cpp?:?定義應(yīng)用程序的入口點。
//
#include?“stdafx.h“
#include?“CefDemo.h“
#include?“Wnd/Win32Wnd.h“
INT_PTR?CALLBACK About(HWND?UINT?WPARAM?LPARAM);
int?APIENTRY?_tWinMain(HINSTANCE?hInstance
?????????????????????HINSTANCE?hPrevInstance
?????????????????????LPTSTR????lpCmdLine
?????????????????????int???????nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
? //?TODO:?在此放置代碼。
void*?sandbox_info?=?NULL;
CefMainArgs?main_args(hInstance);
CefRefPtr?app(new?CCefAppEx);
int?exit_code?=?CefExecuteProcess(main_args?app.get());
if?(exit_code?>=?0)?
{
return?exit_code;
}
CefSettings?settings;
static?wchar_t?szLocale[]?=?L“zh-CN“;
cef_string_utf16_copy(szLocale?wcslen(szLocale)?&settings.locale);
//settings.release_dcheck_enabled?=?false;
//settings.single_process?=?true;
//settings.multi_threaded_message_loop?=?true;
settings.log_severity?=?LOGSEVERITY_DISABLE;
CefInitialize(main_args?settings?app.get());
CWin32WebkitWnd?wnd(L“www.baidu.com“);
wnd.Create(hInstance);
wnd.CenterWindow();
wnd.Show();
CefRunMessageLoop();
#ifndef?_DEBUG
CefShutdown();
#endif
return?0;
}
評論
共有 條評論