Files

29 lines
572 B
Go
Raw Permalink Normal View History

2023-06-06 20:39:24 +10:00
//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,
2023-10-09 17:34:56 +11:00
hInstance: GetApplicationHandle(),
2023-06-06 20:39:24 +10:00
lpszText: text,
lpszCaption: caption,
dwStyle: flags,
lpszIcon: (*uint16)(unsafe.Pointer(uintptr(iconID))),
}
r, _, err := procMessageBoxIndirect.Call(
uintptr(unsafe.Pointer(&params)),
)
if r == 0 {
return 0, err
}
return int32(r), nil
}