Using package lxn/win in main:
win.EnumChildWindows(hw, printme, 0)
Then after main:
func printme(HWND win.HANDLE, LPARAM uintptr) { //HWND hwnd, LPARAM lParam
spew.Dump(HWND)
}
I get:
.\test.go:40: cannot use printme (type func(win.HANDLE, uintptr)) as type uintptr in argument to win.EnumChildWindows
error:exit status 2
I don't understand the error message.
I made it work with:
win.EnumChildWindows(hwnd, syscall.NewCallback(printme), 0)
func printme(hwnd uintptr, lParam uintptr) uintptr {
spew.Dump(hwnd)
fmt.Printf("getWindowText: '%s'
", getWindowText(hwnd))
return 1 // true to continue
}
See lxn/win
issue 19:
The callback signature is wrong: it has to return a value of type
int32
(C BOOL
) that is nonzero if the function should continue enumeration.
See MSDN.For example, it could be:
func printme(hwnd uintptr, lParam uintptr) int32 { spew.Dump(hwnd) return 1 // true to continue }