I want to sub-class the actual window to detect when its size has changed.
This is the code relevant where I've tried to subclassing it, using CallWindowProcW and SetWindowLongW, but it does not show any message when I maximize the window, so I'm supposed I've set wrongly some of those procedures. How to do it?
var oldWindowProc uintptr
func windowProc(hwnd syscall.Handle, msg uint32, wparam, lparam uintptr) (rc uintptr) {
switch msg {
case WM_SIZE:
fmt.Println("Size")
if wparam == SIZE_MAXIMIZED {
fmt.Println("Changed!")
}
default:
return CallWindowProcW(oldWindowProc, hwnd, msg, wparam, lparam)
}
return 0
}
func main() {
oldWindowProc, _ = SetWindowLongW(syscall.Stdin, GWLP_WNDPROC,
syscall.NewCallback(windowProc))
for {
}
}