use native win32 messagebox to prevent wails dialog crash
All checks were successful
Deploy on Master Change / deploy (push) Successful in 37s
All checks were successful
Deploy on Master Change / deploy (push) Successful in 37s
This commit is contained in:
@@ -19,6 +19,7 @@ var (
|
||||
procSetForegroundWindow = user32Window.NewProc("SetForegroundWindow")
|
||||
procFlashWindowEx = user32Window.NewProc("FlashWindowEx")
|
||||
procMessageBeep = user32Window.NewProc("MessageBeep")
|
||||
procMessageBoxW = user32Window.NewProc("MessageBoxW")
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -89,3 +90,13 @@ func findWindowByTitleContains(hint string) uintptr {
|
||||
_, _, _ = procEnumWindows.Call(enumWindowsCallback, 0)
|
||||
return enumFoundHwnd
|
||||
}
|
||||
|
||||
// ShowWarningMessageBox hiển thị hộp thoại cảnh báo Win32 bất đồng bộ
|
||||
func ShowWarningMessageBox(title, message string) {
|
||||
titlePtr, _ := syscall.UTF16PtrFromString(title)
|
||||
messagePtr, _ := syscall.UTF16PtrFromString(message)
|
||||
go func() {
|
||||
// MB_ICONWARNING = 0x00000030, MB_TOPMOST = 0x00040000
|
||||
_, _, _ = procMessageBoxW.Call(0, uintptr(unsafe.Pointer(messagePtr)), uintptr(unsafe.Pointer(titlePtr)), 0x00040030)
|
||||
}()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user