cef3 SetAsPopup 視窗,任務欄的圖示可以修改,但視窗左上角的圖示怎么修改?請大神解答,十分感謝!
uj5u.com熱心網友回復:
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "cefsimple/simple_app.h"
#include <string>
#include "cefsimple/simple_handler.h"
#include "include/cef_browser.h"
#include "include/cef_command_line.h"
#include "include/wrapper/cef_helpers.h"
SimpleApp::SimpleApp() {
}
void SimpleApp::OnContextInitialized() {
CEF_REQUIRE_UI_THREAD();
// Information used when creating the native window.
CefWindowInfo window_info;
#if defined(OS_WIN)
// On Windows we need to specify certain flags that will be passed to
// CreateWindowEx().
window_info.SetAsPopup(NULL, "測驗");
#endif
// SimpleHandler implements browser-level callbacks.
CefRefPtr<SimpleHandler> handler(new SimpleHandler());
// 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 = "http://www.baidu.com/";
// Create the first browser window.
CefBrowserHost::CreateBrowser(window_info, handler.get(), url,
browser_settings, NULL);
}
我已經在cefsimple.rc里自定義了圖示,可還是不行!
IDI_CEFSIMPLE ICON "res\cefsimple.ico"
IDI_SMALL ICON "res\small.ico"
uj5u.com熱心網友回復:
百度搜相關關鍵字。uj5u.com熱心網友回復:
就是百度沒有啊uj5u.com熱心網友回復:
window_info 看有沒有什么引數或函式可以設定iconuj5u.com熱心網友回復:
獲取到CefBrowser指標CefRefPtr<CefBrowser> browser;
下邊代碼可以取到視窗句柄
HWND hWnd = browser->GetHost()->GetWindowHandle();
對視窗設定圖示
CWnd *pWnd = CWnd::FromHandle(hWnd);
pWnd->SetIcon();
偽代碼,沒具體測驗.
uj5u.com熱心網友回復:
正常來說,這里是顯示網站的圖示,導航后可能會被CEF內部修改.
uj5u.com熱心網友回復:
void CCefHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser){
CEF_REQUIRE_UI_THREAD();
HICON hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
ASSERT(hIcon);
CefWindowHandle hWnd = browser->GetHost()->GetWindowHandle();
if (hWnd != NULL)
{
// 修改大圖示
::SendMessage(hWnd, WM_SETICON, TRUE, (LPARAM)hIcon);
//修改小圖示
::SendMessage(hWnd, WM_SETICON, FALSE, (LPARAM)hIcon);
}
}
uj5u.com熱心網友回復:
1 m_hIcon1 = AfxGetApp()->LoadIcon(IDI_ICON1);2 SetIcon(m_hIcon1, TRUE); // Set big icon
SetIcon(m_hIcon1, FALSE); // Set small icon
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/15198.html
標籤:界面
