大家好。
我试着做一个程序,嵌入一个CEF(铬嵌入框架)的html显示。
我只想在我的程序中创建的每个浏览器窗口都有不同的CefCookieManager。我已经阅读了CEF的文档,知道这是可能的。
代码很简单:首先,我编写一个继承自CefRequestContextHandler的类
#pragma once
#include "include/cef_request_context_handler.h"
#include "include/cef_cookie.h"
class WXRequestContextHandler :public CefRequestContextHandler
{
public:
WXRequestContextHandler(){}
~WXRequestContextHandler(){};
CefRefPtr<CefCookieManager> GetCookieManager() OVERRIDE {
return CefCookieManager::CreateManager("F:\\", false);
//return NULL;
}
private:
// Include the default reference counting implementation.
IMPLEMENT_REFCOUNTING(WXRequestContextHandler);
};然后我创建了一个CefRequestContext实例:
m_reqContext = CefRequestContext::CreateContext(new WXRequestContextHandler());最后,使用之前创建的CefRequestContext实例,通过CefBrowserHost::CreateBrowser创建浏览器:
CefBrowserHost::CreateBrowser(info, m_cefHandler.get(), pszURL, settings, m_reqContext);好吧,我认为这真的很简单,事实上我还不知道更多,所以当我运行这些代码来创建第一个窗口时,我得到了一个异常(在libcef.dll中触发,访问冲突0xc00000005),程序崩溃。
不幸的是,我发现关于CefCookieManager和CefRequestHandler的文档和教程真的很差,所以我不得不找到help here.If任何人知道关于我的问题的一些问题或者关于CefCookieManager和CefRequestConextHandler的一些教程,请帮助。
我使用CEF3.1750(2014年6月),VS2013(vc12),win7。
发布于 2014-12-19 20:23:48
我自己解决了这个问题(通过CEF论坛):
here is the link:
https://stackoverflow.com/questions/27552022
复制相似问题