windows上使用Libcef


在win32程序中使用Libcef嵌入浏览器控件,libcef基于最新chrome内核,无IE兼容性问题,你值得拥有。源码中包含了cef的使用:初始化、回调设置、JS与C++交互等,适合初学者学习。(VS2008工程)
资源截图
代码片段和文件信息
// CefDemo.cpp : 定义应用程序的入口点。
//

#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;
}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)