Home > Software engineering >  Cef3 SetAsPopup window icon to modify
Cef3 SetAsPopup window icon to modify

Time:11-12

Cef3 SetAsPopup window, the taskbar icon can be modified, but how to modify window icon in the upper left corner? Great god answer please, thank you very much!

CodePudding user response:

//Copyright (c) 2013 The Chromium Embedded Framework The 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

# include "cefsimple/simple_handler. H"
# include "include/cef_browser. H"
# include "include/cef_command_line. H"
# include "include/wrapper/cef_helpers h"

SimpleApp has: : SimpleApp has () {
}

Void SimpleApp has: : OnContextInitialized () {
CEF_REQUIRE_UI_THREAD ();

//Information, informs the 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, "test");
# endif

//SimpleHandler implements browser - level callbacks.
CefRefPtr 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 the
Home//that the default URL.
CefRefPtr Command_line=
CefCommandLine: : GetGlobalCommandLine ();
Url=command_line - & gt; GetSwitchValue (" url ");
If (url. The empty ())
Url="http://www.baidu.com/";

//Create the first browser window.
CefBrowserHost: : CreateBrowser (window_info, handler. The get (), url,
Browser_settings, NULL);
}


I have been in the cefsimple. Rc custom icon, can or not!
IDI_CEFSIMPLE ICON "res \ cefsimple. Ico"
IDI_SMALL ICON "res \ small. Ico"

CodePudding user response:

Baidu search relevant keywords,

CodePudding user response:

Is the baidu did not ah

CodePudding user response:

Window_info look for any parameters or function can set the icon

CodePudding user response:

Get CefBrowser pointer

CefRefPtr Browser;

Below code can get into the window handle
HWND HWND=browser - & gt; GetHost () - & gt; GetWindowHandle ();

The window Settings icon
The CWnd * pWnd=CWnd: : FromHandle (hWnd);
PWnd - & gt; SetIcon ();

Pseudo code, there is no specific test.

CodePudding user response:

reference 5 floor jinan200711 reply:
pseudo code, no specific test.


Website icon is displayed normally, this is, after the navigation may be modified by the CEF inside.

CodePudding user response:

Void CCefHandler: : OnAfterCreated (CefRefPtr Browser)
{
CEF_REQUIRE_UI_THREAD ();

HICON HICON=AfxGetApp () - & gt; LoadIcon (IDR_MAINFRAME);
ASSERT (hIcon);

CefWindowHandle hWnd=browser - & gt; GetHost () - & gt; GetWindowHandle ();
If (hWnd!=NULL)
{
//modify large ICONS
: : SendMessage (hWnd WM_SETICON, TRUE, (LPARAM) hIcon);

//modify the small icon
: : SendMessage (hWnd WM_SETICON, FALSE, (LPARAM) hIcon);
}
}

CodePudding user response:

1 m_hIcon1=AfxGetApp () - & gt; LoadIcon (IDI_ICON1);
2 SetIcon (m_hIcon1, TRUE);//Set the big icon
SetIcon (m_hIcon1, FALSE);//Set the small icon
  • Related