From 49103abe7c927bd05a5dc5d3e7b740d583605dc0 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 9 Apr 2014 11:13:35 -0400 Subject: [PATCH] As it turns out, Windows does have a facility for windows that only serve as message dispatches; let's use it for our message handler. (I only found this out while looking up SetParent() for the previous commit). --- uitask_windows.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/uitask_windows.go b/uitask_windows.go index 8369e33..ccd411a 100644 --- a/uitask_windows.go +++ b/uitask_windows.go @@ -135,6 +135,11 @@ const ( msghandlerclass = "gomsghandler" ) +var ( + // fron winuser.h; var because Go won't let me + _HWND_MESSAGE = -3 +) + func makeMessageHandler() (hwnd _HWND, err error) { wc := &_WNDCLASS{ lpszClassName: uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(msghandlerclass))), @@ -159,7 +164,7 @@ func makeMessageHandler() (hwnd _HWND, err error) { uintptr(_CW_USEDEFAULT), uintptr(_CW_USEDEFAULT), uintptr(_CW_USEDEFAULT), - uintptr(_NULL), + uintptr(_HWND_MESSAGE), uintptr(_NULL), uintptr(hInstance), uintptr(_NULL))