代码拉取完成,页面将自动刷新
#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;
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。