cef3 SetAsPopup 窗口图标修改

asptop 2018-05-09 01:16:12
cef3 SetAsPopup 窗口,任务栏的图标可以修改,但窗口左上角的图标怎么修改?请大神解答,十分感谢!

...全文
1643 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
schlafenhamster 2020-05-05
  • 打赏
  • 举报
回复
1 m_hIcon1 = AfxGetApp()->LoadIcon(IDI_ICON1);
2 SetIcon(m_hIcon1, TRUE); // Set big icon
SetIcon(m_hIcon1, FALSE); // Set small icon
GD_ZHOU 2020-05-04
  • 打赏
  • 举报
回复
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); } }
oyljerry 2018-05-11
  • 打赏
  • 举报
回复
window_info 看有没有什么参数或函数可以设置icon
jinan200711 2018-05-11
  • 打赏
  • 举报
回复
引用 5 楼 jinan200711 的回复:
伪代码,没具体测试.
正常来说,这里是显示网站的图标,导航后可能会被CEF内部修改.
jinan200711 2018-05-11
  • 打赏
  • 举报
回复
获取到CefBrowser指针 CefRefPtr<CefBrowser> browser; 下边代码可以取到窗口句柄 HWND hWnd = browser->GetHost()->GetWindowHandle(); 对窗口设置图标 CWnd *pWnd = CWnd::FromHandle(hWnd); pWnd->SetIcon(); 伪代码,没具体测试.
asptop 2018-05-09
  • 打赏
  • 举报
回复
就是百度没有啊
asptop 2018-05-09
  • 打赏
  • 举报
回复
// 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"

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧