Skip to content
This repository has been archived by the owner on Aug 23, 2019. It is now read-only.

Commit

Permalink
resolve #19 User32 - SetMenuItemInfoW
Browse files Browse the repository at this point in the history
  • Loading branch information
ergoz committed Aug 11, 2019
1 parent ba53fd0 commit 67c3459
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions user32.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ var (
procLoadImageW = moduser32.NewProc("LoadImageW")
procSetMenuInfo = moduser32.NewProc("SetMenuInfo")
procInsertMenuItemW = moduser32.NewProc("InsertMenuItemW")
procSetMenuItemInfoW = moduser32.NewProc("SetMenuItemInfoW")
)

func SendMessageTimeout(hwnd HWND, msg uint32, wParam, lParam uintptr, fuFlags, uTimeout uint32, lpdwResult uintptr) uintptr {
Expand Down Expand Up @@ -1451,3 +1452,18 @@ func InsertMenuItem(hMenu HMENU, item uint32, fByPosition bool, lpmi MENUITEMINF

return ret != 0, nil
}

// SetMenuItemInfo Changes information about a menu item.
// See: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setmenuiteminfow
func SetMenuItemInfo(hMenu HMENU, item uint32, fByPosition bool, lpmi MENUITEMINFOW) (bool, error) {
ret, _, err := procSetMenuItemInfoW.Call(
uintptr(hMenu),
uintptr(item),
uintptr(BoolToBOOL(fByPosition)),
uintptr(unsafe.Pointer(&lpmi)),
)
if !IsErrSuccess(err) {
return false, err
}
return ret != 0, nil
}

0 comments on commit 67c3459

Please sign in to comment.