UNPKG

libwin32

Version:

Node bindings to native Win32 DLLs through Koffi

40 lines 1.73 kB
import { cBOOL, cUINT, cSTR, cHANDLE } from '../ctypes.js'; import { cRECT } from '../structs.js'; import { user32 } from './lib.js'; /** * Appends a new item to the end of the specified menu bar, drop-down menu, submenu, or shortcut menu. * * https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-appendmenuw */ export function AppendMenu(hMenu, flags, idNewItem, newItem) { AppendMenu.native ??= user32.func('AppendMenuW', cBOOL, [cHANDLE, cUINT, cUINT, cSTR]); return AppendMenu.native(hMenu, flags, idNewItem, newItem) !== 0; } /** * Sets the checked state of a menu item. * * https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-checkmenuitem */ export function CheckMenuItem(hMenu, idCheckItem, check) { CheckMenuItem.native ??= user32.func('CheckMenuItem', cUINT, [cHANDLE, cUINT, cUINT]); return CheckMenuItem.native(hMenu, idCheckItem, check); } /** * Creates a drop-down menu, submenu, or shortcut menu. * * https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-createpopupmenu */ export function CreatePopupMenu() { CreatePopupMenu.native ??= user32.func('CreatePopupMenu', cHANDLE, []); return CreatePopupMenu.native(); } /** * Displays a shortcut menu at the specified location and tracks the selection of items on the menu. * * https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-trackpopupmenu */ export function TrackPopupMenu(hMenu, flags, x, y, hWnd, rect = null) { TrackPopupMenu.native ??= user32.func('TrackPopupMenu', cBOOL, [cHANDLE, cUINT, cUINT, cUINT, cUINT, cHANDLE, cRECT]); return TrackPopupMenu.native(hMenu, flags, x, y, 0, hWnd, rect) !== 0; } //# sourceMappingURL=menu.js.map