将 macOS 桌面应用改为通用二进制并动态写入最低系统版本,避免 Intel Mac 无法启动。统一桌面应用名称与托盘展示,并补充测试确保相关行为稳定。
38 lines
696 B
Go
38 lines
696 B
Go
//go:build windows
|
|
|
|
package main
|
|
|
|
import (
|
|
"syscall"
|
|
"unsafe"
|
|
)
|
|
|
|
const (
|
|
MB_ICONERROR = 0x10
|
|
MB_ICONINFORMATION = 0x40
|
|
)
|
|
|
|
var (
|
|
user32 = syscall.NewLazyDLL("user32.dll")
|
|
procMessageBoxW = user32.NewProc("MessageBoxW")
|
|
)
|
|
|
|
func showError(title, message string) {
|
|
messageBox(title, message, MB_ICONERROR)
|
|
}
|
|
|
|
func showAbout() {
|
|
messageBox(appAboutTitle, aboutMessage(), MB_ICONINFORMATION)
|
|
}
|
|
|
|
func messageBox(title, message string, flags uint) {
|
|
titlePtr, _ := syscall.UTF16PtrFromString(title)
|
|
messagePtr, _ := syscall.UTF16PtrFromString(message)
|
|
procMessageBoxW.Call(
|
|
0,
|
|
uintptr(unsafe.Pointer(messagePtr)),
|
|
uintptr(unsafe.Pointer(titlePtr)),
|
|
uintptr(flags),
|
|
)
|
|
}
|