ui/app: (windows) use the new golang.org/x/sys/windows.MessageBox function

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-05-27 11:35:40 +02:00
parent e5ddb0b903
commit 5cc9906eb8
4 changed files with 6 additions and 13 deletions
+1 -8
View File
@@ -53,16 +53,9 @@ func mustLoadDLL(dll *syscall.LazyDLL, name string) {
if loadErr == nil {
return
}
user32 := syscall.NewLazySystemDLL("user32.dll")
messageBox := user32.NewProc("MessageBoxW")
if err := messageBox.Find(); err != nil {
panic(loadErr)
}
pmsg := syscall.StringToUTF16Ptr("Failed to load " + name)
ptitle := syscall.StringToUTF16Ptr("Error")
const MB_ICONERROR = 0x00000010
const MB_SYSTEMMODAL = 0x00001000
messageBox.Call(0 /* HWND */, uintptr(unsafe.Pointer(pmsg)), uintptr(unsafe.Pointer(ptitle)), MB_ICONERROR|MB_SYSTEMMODAL)
syscall.MessageBox(0 /* HWND */, pmsg, ptitle, syscall.MB_ICONERROR|syscall.MB_SYSTEMMODAL)
os.Exit(1)
}