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).

This commit is contained in:
Pietro Gagliardi 2014-04-09 11:13:35 -04:00
parent 67c56c3766
commit 49103abe7c
1 changed files with 6 additions and 1 deletions

View File

@ -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))