1 Star 2 Fork 2

setoutsoft/soui-cef

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CefBrowserWrapper.cpp 1.61 KB
一键复制 编辑 原始数据 按行查看 历史
tb7158217 提交于 2015-09-29 20:07 . soui-cef
#include "StdAfx.h"
#include "CefBrowserWrapper.h"
#include "CefClientImpl.h"
#include "include/cef_browser.h"
#include "include/cef_command_line.h"
#include "include/wrapper/cef_helpers.h"
CefClientImpl* g_sh = NULL;
void CefBrowserWrapper::CreateCef(RECT rc)
{
if (g_sh == NULL) {
g_sh = new CefClientImpl;
}
if (g_sh->GetBrowser() != NULL) {
HWND brower_wnd = g_sh->GetBrowser()->GetHost()->GetWindowHandle();
::SetWindowPos(brower_wnd, NULL, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOZORDER | SWP_NOACTIVATE);
return;
}
CefWindowInfo window_info;
window_info.SetAsChild(parent_window_, rc);
// SimpleHandler implements browser-level callbacks.
CefRefPtr<CefClientImpl> handler(g_sh);
// Specify CEF browser settings here.
CefBrowserSettings browser_settings;
std::string url;
// Check if a "--url=" value was provided via the command-line. If so, use
// that instead of the default URL.
CefRefPtr<CefCommandLine> command_line =
CefCommandLine::GetGlobalCommandLine();
url = command_line->GetSwitchValue("url");
if (url.empty())
//url = "lightyear://messageHistory/handler.html";
url = "http://www.baidu.com/";
// Create the first browser window.
CefBrowserHost::CreateBrowser(window_info, handler.get(), url, browser_settings, NULL);
}
void CefBrowserWrapper::AdjuestCef(CRect rc)
{
if (g_sh->GetBrowser() != NULL) {
HWND brower_wnd = g_sh->GetBrowser()->GetHost()->GetWindowHandle();
::SetWindowPos(brower_wnd, NULL, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOZORDER | SWP_NOACTIVATE);
return;
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/setoutsoft/soui-cef.git
git@gitee.com:setoutsoft/soui-cef.git
setoutsoft
soui-cef
soui-cef
master

搜索帮助