diff options
Diffstat (limited to 'uitask_windows.go')
| -rw-r--r-- | uitask_windows.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/uitask_windows.go b/uitask_windows.go index f260e79..ca00d3a 100644 --- a/uitask_windows.go +++ b/uitask_windows.go @@ -29,6 +29,7 @@ const ( msgQuit = _WM_APP + iota + 1 // + 1 just to be safe msgSetAreaSize msgRepaintAll + msgPost ) func uiinit() error { @@ -66,6 +67,15 @@ func ui() { msgloop() } +// we'll use SendMessage() here, which will do a thread switch, call the function immediately, and wait for it to return, so we don't have to worry about the garbage collector collecting data +func uipost(w *Window, data interface{}) { + _sendMessage.Call( + uintptr(w.sysData.hwnd), // note: we pass this directly to the window + msgPost, + 0, + uintptr(unsafe.Pointer(&data))) +} + var ( _dispatchMessage = user32.NewProc("DispatchMessageW") _getActiveWindow = user32.NewProc("GetActiveWindow") |
