Git Product home page Git Product logo

Comments (3)

Jonesey13 avatar Jonesey13 commented on September 3, 2024 2

For anyone trying to get this working, this was the change I made to pass the icon from the app to the window:

//webview_edge.cpp

   browser_window(msg_cb_t cb, const char* title, int width, int height, bool resizable)
        : m_cb(cb)
    {
        HINSTANCE hInstance = GetModuleHandle(nullptr);

        HWND currentWindow = GetActiveWindow();

        // "1" is the default icon resource name used by winres 
        HICON parentIcon = (HICON)LoadImage(
            hInstance, 
            MAKEINTRESOURCE(1), 
            IMAGE_ICON, 
            0, 
            0,
            LR_DEFAULTSIZE
        );

        WNDCLASSEX wc;
        ZeroMemory(&wc, sizeof(WNDCLASSEX));
        wc.cbSize = sizeof(WNDCLASSEX);
        wc.hInstance = hInstance;
        wc.lpfnWndProc = WebviewWndProc;
        wc.lpszClassName = L"webview";
        wc.hIcon = parentIcon; // add the icon here
        RegisterClassEx(&wc);

This is my rust build script:

\\build.rs
use winres;

fn main() {
    let mut res = winres::WindowsResource::new();
    res.set_icon("Micro.ico");
    res.compile().unwrap();
}

I can't think of an easy way to locate the icon used by the taskbar (and so have had to refer to the icon resource by name).

One possibility would be to agree upon a default resource name to be used for the window icon (rather than just 1!). winres supports setting the resource id so this wouldn't cause issues for Rust users.

from web-view.

Boscop avatar Boscop commented on September 3, 2024

You mean the icon that appears in the title bar and task bar?

Doesn't it use the exe icon for that?

from web-view.

eedahl avatar eedahl commented on September 3, 2024

It uses the exe icon for the task bar, but not for the upper left hand side corner.

https://gyazo.com/5e00afd945c9d862d6734cb23686555e
https://gyazo.com/ae15922cb6247b2ff3240ddcf1750796

from web-view.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.