aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKali Kaneko2018-10-18 11:46:49 +0200
committerKali Kaneko2018-10-19 21:10:45 +0200
commitac73430500283a19a3602cc33eb49a440e38554b (patch)
treec707d9c8ac00a5c34cb4c325651a942b77e5c125
parent5fb0feca3c0677e9fa31e579ff69631f49a379a2 (diff)
downloadsystray-ac73430500283a19a3602cc33eb49a440e38554b.tar.bz2
get rid of confusing error
For some reason, at least in Windows 10, the return value is 0, but the error message states that the operation completed successfully.
-rw-r--r--systray_windows.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/systray_windows.go b/systray_windows.go
index 3624214..040cdbd 100644
--- a/systray_windows.go
+++ b/systray_windows.go
@@ -8,6 +8,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
+ "syscall"
"unsafe"
"golang.org/x/sys/windows"
@@ -524,6 +525,7 @@ func (t *winTray) addSeparatorMenuItem(menuId int32) error {
func (t *winTray) hideMenuItem(menuId int32) error {
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms647629(v=vs.85).aspx
const MF_BYCOMMAND = 0x00000000
+ const ERROR_SUCCESS = 0
res, _, err := pDeleteMenu.Call(
uintptr(t.menu),
@@ -531,6 +533,9 @@ func (t *winTray) hideMenuItem(menuId int32) error {
MF_BYCOMMAND,
)
if res == 0 {
+ if int(err.(syscall.Errno)) == ERROR_SUCCESS {
+ return nil
+ }
return err
}