Пример #1
0
func (app *DemoApp) RunMessageLoop() {
	msg := w32.MSG{}
	for w32.GetMessage(&msg, 0, 0, 0) > 0 {
		w32.TranslateMessage(&msg)
		w32.DispatchMessage(&msg)
	}
}
Пример #2
0
func (this *Window) HandleWndMessages() {
	var m w32.MSG

	for w32.GetMessage(&m, this.hwnd, 0, 0) != 0 {
		w32.TranslateMessage(&m)
		w32.DispatchMessage(&m)
	}
}
Пример #3
0
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)
}
Пример #4
0
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)
		}
	}
}
Пример #5
0
// 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
}