2 Star 0 Fork 1

swiftlc / CefLib

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
quick_test.txt 1.58 KB
一键复制 编辑 原始数据 按行查看 历史
swiftlc 提交于 2019-11-25 21:29 . + 导出manifest文件
#include "windows.h"
#include "include/cef_app.h"
#include <include/internal/cef_win.h>
#include "include/cef_client.h"
class ClientHandler :public CefClient, public CefLifeSpanHandler
{
public:
virtual CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() { return this; }
//CefLifeSpanHandler
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) { browser_ = browser; }
CefRefPtr<CefBrowser> browser_;
IMPLEMENT_REFCOUNTING(ClientHandler);
};
class ClientApp :public CefApp, public CefBrowserProcessHandler
{
public:
virtual CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() {
return this;
}
virtual void OnContextInitialized()
{
CefWindowInfo window_info;
window_info.SetAsPopup(NULL, L"CefTmp");
CefBrowserSettings setting;
CefBrowserHost::CreateBrowser(window_info, new ClientHandler, L"http://www.baidu.com", setting, NULL);
}
IMPLEMENT_REFCOUNTING(ClientApp);
};
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
CefEnableHighDPISupport();
// Provide CEF with command-line arguments.
CefMainArgs main_args(::GetModuleHandle(NULL));
CefRefPtr<ClientApp> app{ new ClientApp };
int exit_code = CefExecuteProcess(main_args, app, NULL);
if (exit_code >= 0) {
// The sub-process has completed so return here.
return exit_code;
}
CefSettings settings;
settings.no_sandbox = true;
settings.remote_debugging_port = 8080;
CefInitialize(main_args, settings, app.get(), NULL);
CefRunMessageLoop();
CefShutdown();
return 0;
}
1
https://gitee.com/swiftlc/CefLib.git
git@gitee.com:swiftlc/CefLib.git
swiftlc
CefLib
CefLib
master

搜索帮助