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

walk.NewMainWindow failed with message "panic: TTM_ADDTOOL failed" #28

Closed
sungit opened this issue Oct 29, 2012 · 7 comments
Closed

walk.NewMainWindow failed with message "panic: TTM_ADDTOOL failed" #28

sungit opened this issue Oct 29, 2012 · 7 comments

Comments

@sungit
Copy link

sungit commented Oct 29, 2012

The goplay failed with this output when fed with the content of examples/drawing.go. But when doing: go run drawing.go , it's ok.

The other program i write using the ui2walk.exe generated ui files runs into this kind of panic again.

It seems there's something wrong with walk.InitWidget , is't right? How to fix it?

panic: TTM_ADDTOOL failed

Stack:
E:/repos/libs/gopkgs/src/github.com/lxn/walk/error.go:77 (0x4219b9)
    com/lxn/walk.newErr: return &Error{message: message, stack: debug.Stack()}
E:/repos/libs/gopkgs/src/github.com/lxn/walk/error.go:81 (0x421a50)
    com/lxn/walk.newError: return processError(newErr(message))
E:/repos/libs/gopkgs/src/github.com/lxn/walk/tooltip.go:113 (0x42b716)
    com/lxn/walk.(*ToolTip).AddTool: return newError("TTM_ADDTOOL failed")
E:/repos/libs/gopkgs/src/github.com/lxn/walk/widget.go:423 (0x4307fe)
    com/lxn/walk.InitWidget: if err := globalToolTip.AddTool(widget); err != nil {
E:/repos/libs/gopkgs/src/github.com/lxn/walk/mainwindow.go:30 (0x423b06)
    com/lxn/walk.NewMainWindow: WS_EX_CONTROLPARENT); err != nil {
C:/Documents and Settings/Administrator/Local Settings/Temp/compile11.go:82 (0x4017d1)
    main: mainWnd, _ := walk.NewMainWindow()
C:/Go/src/pkg/runtime/proc.c:244 (0x40f12a)
    main: main·main();
C:/Go/src/pkg/runtime/proc.c:271 (0x40f1c2)
    goexit: runtime·goexit(void)

@lxn
Copy link
Owner

lxn commented Oct 29, 2012

The problem can be fixed by putting a matching application manifest file into the directory where your executable resides.

See the Walk examples for such manifest files.

@sungit
Copy link
Author

sungit commented Oct 30, 2012

It works, thank you!

@sungit sungit closed this as completed Nov 4, 2012
@beppler
Copy link

beppler commented Feb 12, 2015

I have the same problem even with the rsrc.syso being linked in the notifyicon example.

2015/02/11 22:52:37 TTM_ADDTOOL failed

    Stack:
    C:/Dev/Go/Go/src/github.com/lxn/walk/error.go:79 (0x44c918)
            newErr: return &Error{message: message, stack: debug.Stack()}
    C:/Dev/Go/Go/src/github.com/lxn/walk/error.go:83 (0x44ca9b)
            newError: return processError(newErr(message))
    C:/Dev/Go/Go/src/github.com/lxn/walk/tooltip.go:115 (0x46605a)
            (*ToolTip).AddTool: return newError("TTM_ADDTOOL failed")
    C:/Dev/Go/Go/src/github.com/lxn/walk/widget.go:106 (0x469ddf)
            (*WidgetBase).init: if err := globalToolTip.AddTool(wb); err != nil {
    C:/Dev/Go/Go/src/github.com/lxn/walk/window.go:396 (0x46d063)
            InitWindow: if err := wb.init(widget); err != nil {
    C:/Dev/Go/Go/src/github.com/lxn/walk/widget.go:85 (0x469b7c)
            InitWidget: if err := InitWindow(widget, parent, className, style|win.WS_CHILD, exStyle); err != nil {
    C:/Dev/Go/Go/src/github.com/lxn/walk/composite.go:31 (0x448c0d)
            newCompositeWithStyle: win.WS_EX_CONTROLPARENT); err != nil {
    C:/Dev/Go/Go/src/github.com/lxn/walk/composite.go:39 (0x448d77)
            NewComposite: return newCompositeWithStyle(parent, 0)
    C:/Dev/Go/Go/src/github.com/lxn/walk/form.go:78 (0x44e410)
            (*FormBase).init: if fb.clientComposite, err = NewComposite(form); err != nil {
    C:/Dev/Go/Go/src/github.com/lxn/walk/window.go:388 (0x46cfa4)
            InitWindow: if err := fb.init(form); err != nil {
    C:/Dev/Go/Go/src/github.com/lxn/walk/mainwindow.go:37 (0x452e20)
            NewMainWindow: win.WS_EX_CONTROLPARENT); err != nil {
    C:/Dev/Go/Go/src/github.com/lxn/walk/examples/notifyicon/notifyicon.go:18 (0x401031)
            main: mw, err := walk.NewMainWindow()
    c:/go/src/runtime/proc.go:63 (0x41352a)
    c:/go/src/runtime/asm_amd64.s:2232 (0x43af81)

@logrusorgru
Copy link

The problem can be fixed by putting a matching application manifest file into the directory where your executable resides.

See the Walk examples for such manifest files.

What manifest?

@zhaozhongshu
Copy link

Stack:
goroutine 1 [running, locked to thread]:
runtime/debug.Stack(0x0, 0x0, 0x0)
        C:/go1.11.9.windows-386/src/runtime/debug/stack.go:24 +0x8a github.com/lxn/walk.newErr(0x82e131, 0x12, 0x1145b290, 0x0)
        github.com/lxn/walk/error.go:81 +0x1e
github.com/lxn/walk.newError(0x82e131, 0x12, 0x0, 0x1145b290)
        github.com/lxn/walk/error.go:85 +0x29
github.com/lxn/walk.(*ToolTip).addTool(0x114666c0, 0x8999e0, 0x1145c840, 0x7d1800, 0x811d01, 0x114aaee0)
        github.com/lxn/walk/tooltip.go:201 +0xad
github.com/lxn/walk.(*ToolTip).AddTool(0x114666c0, 0x8999e0, 0x1145c840, 0x6e7575, 0x4085a0)
        github.com/lxn/walk/tooltip.go:179 +0x36
github.com/lxn/walk.(*WidgetBase).init(0x1145c840, 0x898c20, 0x1145c840, 0x898c20, 0x1145c840)
        github.com/lxn/walk/widget.go:130 +0x7b
github.com/lxn/walk.InitWindow(0x31a14448, 0x1145c840, 0x897340, 0x11492340, 0x8337b7, 0x1c, 0x50000000, 0x10000, 0x0, 0x0)
        github.com/lxn/walk/window.go:471 +0x255
github.com/lxn/walk.InitWidget(0x898c20, 0x1145c840, 0x897340, 0x11492340, 0x8337b7, 0x1c, 0x50000000, 0x10000, 0x8234a0, 0xb65f00)
        github.com/lxn/walk/widget.go:107 +0x8d
github.com/lxn/walk.NewCompositeWithStyle(0x897340, 0x11492340, 0x0, 0x897340, 0x11492340, 0x898780)
        github.com/lxn/walk/composite.go:28 +0xb5
github.com/lxn/walk.NewComposite(0x898780, 0x11492340, 0x11492340, 0x898780, 0x11492340)

@kjk
Copy link

kjk commented Apr 30, 2019

See https://www.programming-books.io/essential/go/a-first-window-app-e87631a7f8a94e8f92f9114e8e6baf0a, the part in "Compiling as a windows application" section.

You need to properly include manifest, it's explained in more detail there.

@zhaozhongshu
Copy link

Stack:
goroutine 1 [running, locked to thread]:
runtime/debug.Stack(0x0, 0x0, 0x0)
        C:/go1.11.9.windows-386/src/runtime/debug/stack.go:24 +0x8a github.com/lxn/walk.newErr(0x82e131, 0x12, 0x1145b290, 0x0)
        github.com/lxn/walk/error.go:81 +0x1e
github.com/lxn/walk.newError(0x82e131, 0x12, 0x0, 0x1145b290)
        github.com/lxn/walk/error.go:85 +0x29
github.com/lxn/walk.(*ToolTip).addTool(0x114666c0, 0x8999e0, 0x1145c840, 0x7d1800, 0x811d01, 0x114aaee0)
        github.com/lxn/walk/tooltip.go:201 +0xad
github.com/lxn/walk.(*ToolTip).AddTool(0x114666c0, 0x8999e0, 0x1145c840, 0x6e7575, 0x4085a0)
        github.com/lxn/walk/tooltip.go:179 +0x36
github.com/lxn/walk.(*WidgetBase).init(0x1145c840, 0x898c20, 0x1145c840, 0x898c20, 0x1145c840)
        github.com/lxn/walk/widget.go:130 +0x7b
github.com/lxn/walk.InitWindow(0x31a14448, 0x1145c840, 0x897340, 0x11492340, 0x8337b7, 0x1c, 0x50000000, 0x10000, 0x0, 0x0)
        github.com/lxn/walk/window.go:471 +0x255
github.com/lxn/walk.InitWidget(0x898c20, 0x1145c840, 0x897340, 0x11492340, 0x8337b7, 0x1c, 0x50000000, 0x10000, 0x8234a0, 0xb65f00)
        github.com/lxn/walk/widget.go:107 +0x8d
github.com/lxn/walk.NewCompositeWithStyle(0x897340, 0x11492340, 0x0, 0x897340, 0x11492340, 0x898780)
        github.com/lxn/walk/composite.go:28 +0xb5
github.com/lxn/walk.NewComposite(0x898780, 0x11492340, 0x11492340, 0x898780, 0x11492340)

See https://www.programming-books.io/essential/go/a-first-window-app-e87631a7f8a94e8f92f9114e8e6baf0a, the part in "Compiling as a windows application" section.

You need to properly include manifest, it's explained in more detail there.

it's works on windows7, panic only on windows XP

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

6 participants