Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to set the icon on the title bar #53

Open
rinetd opened this issue Jun 10, 2018 · 2 comments
Open

how to set the icon on the title bar #53

rinetd opened this issue Jun 10, 2018 · 2 comments

Comments

@rinetd
Copy link

rinetd commented Jun 10, 2018

20180610202948
20180610203615

i found some code like this ,but i don't known how to use it.
SetClassLong(hwnd,GCL_HICON,(LONG)LoadIcon(hinstance, IDI_ICON ));

@ryujimiya
Copy link
Contributor

ryujimiya commented Jun 21, 2018

Hi, rinetd!

if you use lxn/walk and not directly use lxn/win,
you may load the icon file and put it to window like this;

    icon, iconErr := walk.Resources.Icon("foo.ico")

    err := MainWindow{
        AssignTo: &mainWin,  
        Title:    "MainWindow",
        Icon:     icon,
        (snip)
    }.Create()

if you want to load icon from resources,
first you have to rsrc

rsrc -arch amd64 -manifest foo.exe.manifest -ico foo.ico -o rsrc.syso

and, load it like this:

	icon, iconErr := walk.Resources.Icon("3")

@lxn
Copy link
Owner

lxn commented Oct 10, 2018

You can do it like this, too:

err := MainWindow{
        AssignTo: &mainWin,  
        Title:    "MainWindow",
        Icon:     "foo.ico",
        (snip)
    }.Create()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants