mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-04 07:29:56 +08:00
29 lines
572 B
Go
29 lines
572 B
Go
//go:build windows
|
|
|
|
package w32
|
|
|
|
import (
|
|
"unsafe"
|
|
)
|
|
|
|
func MessageBoxWithIcon(hwnd HWND, text *uint16, caption *uint16, iconID int, flags uint32) (int32, error) {
|
|
|
|
params := MSGBOXPARAMS{
|
|
cbSize: uint32(unsafe.Sizeof(MSGBOXPARAMS{})),
|
|
hwndOwner: hwnd,
|
|
hInstance: GetApplicationHandle(),
|
|
lpszText: text,
|
|
lpszCaption: caption,
|
|
dwStyle: flags,
|
|
lpszIcon: (*uint16)(unsafe.Pointer(uintptr(iconID))),
|
|
}
|
|
|
|
r, _, err := procMessageBoxIndirect.Call(
|
|
uintptr(unsafe.Pointer(¶ms)),
|
|
)
|
|
if r == 0 {
|
|
return 0, err
|
|
}
|
|
return int32(r), nil
|
|
}
|