func (app *DemoApp) RunMessageLoop() { msg := w32.MSG{} for w32.GetMessage(&msg, 0, 0, 0) > 0 { w32.TranslateMessage(&msg) w32.DispatchMessage(&msg) } }
func (this *Window) HandleWndMessages() { var m w32.MSG for w32.GetMessage(&m, this.hwnd, 0, 0) != 0 { w32.TranslateMessage(&m) w32.DispatchMessage(&m) } }
func RunMainLoop() int { var m w32.MSG for w32.GetMessage(&m, 0, 0, 0) != 0 { if !PreTranslateMessage(&m) { w32.TranslateMessage(&m) w32.DispatchMessage(&m) } } w32.GdiplusShutdown() return int(m.WParam) }
func run() { msg := &w32.MSG{} for { switch val := w32.GetMessage(msg, 0, 0, 0); val { case -1: log.Printf("w32: error: %v\n", getLastError()) os.Exit(1) case 0: return default: w32.TranslateMessage(msg) w32.DispatchMessage(msg) } } }
// Adds the notification icon and starts handling the mouse // interaction with the icon. // Calls to this function will block until the Stop() function // will be called from another goroutine/thread. // Returns an error, if adding the notify icons fails. func (t *_NotifyIcon) Start() (err error) { log.Println("Creating notification icon") tooltipUtf16, _ := syscall.UTF16FromString(t.tooltip) t.nid.CbSize = w32.DWORD(unsafe.Sizeof(&t.nid)) t.nid.HWnd = t.hwnd t.nid.UFlags = _NIF_MESSAGE | _NIF_ICON | _NIF_TIP t.nid.UID = niUID t.nid.UCallbackMessage = niCallbackMessage copy(t.nid.SzTip[:], tooltipUtf16) err = shellNotifyIcon(_NIM_ADD, &t.nid) if err != nil { return } var msg w32.MSG for w32.GetMessage(&msg, t.hwnd, uint32(0), uint32(0)) != 0 { w32.TranslateMessage(&msg) w32.DispatchMessage(&msg) } return nil }