Struct winsafe::HMENU [−][src]
#[repr(C)]pub struct HMENU { /* fields omitted */ }
Expand description
Handle to a menu.
Implementations
Creates a new handle instance by wrapping a pointer.
This method is common to all handle types.
Consumes the handle returning the underlying raw pointer.
This method is common to all handle types.
Tells if the handle is invalid (null).
This method is common to all handle types.
AppendMenu
method.
This method is rather tricky, consider using
HMENU::AppendMenuEnum
.
A more convenient HMENU::AppendMenu
.
Examples
Adding multiple entries at once, with their command IDs:
use winsafe::{HMENU, MenuEnum};
let my_hmenu: HMENU; // initialized somewhere
const ID_FILE_OPEN: i32 = 2001;
const ID_FILE_SAVE: i32 = 2002;
const ID_FILE_EXIT: i32 = 2003;
my_hmenu.AppendMenuEnum(&[
MenuEnum::Entry(ID_FILE_OPEN, "&Open"),
MenuEnum::Entry(ID_FILE_OPEN, "&Save"),
MenuEnum::Separator,
MenuEnum::Entry(ID_FILE_EXIT, "E&xit"),
])?;
CheckMenuItem
method.
CreateMenu
static method.
Note: If not attached to a window, must be paired with an
HMENU::DestroyMenu
call.
CreatePopupMenu
static method.
Note: If not attached to a window, must be paired with an
HMENU::DestroyMenu
call.
DeleteMenu
method.
DestroyMenu
method.
EnableMenuItem
method.
Examples
Disabling a menu item:
use winsafe::{HMENU, IdPos};
const ID_FILE_OPEN: i32 = 101;
let hmenu: HMENU; // initialized somewhere
hmenu.EnableMenuItem(
IdPos::Id(ID_FILE_OPEN),
false,
)?;
Disabling multiple menu items at once:
use winsafe::{HMENU, IdPos};
const ID_FILE_OPEN: i32 = 201;
const ID_FILE_SAVE: i32 = 202;
let hmenu: HMENU; // initialized somewhere
[
(ID_FILE_OPEN, "Open\tCtrl+O"),
(ID_FILE_SAVE, "&Save"),
].iter()
.map(|(id, txt)| hmenu.EnableMenuItem(
IdPos::Id(*id),
false,
))
.collect::<Result<Vec<_>, _>>()?;
GetMenuDefaultItem
method.
GetMenuInfo
method.
GetMenuItemCount
method.
GetMenuItemInfo
method.
GetMenuItemID
method.
GetMenuState
method.
GetMenuString
method.
GetSubMenu
method.
InsertMenuItem
method.
RemoveMenu
method.
SetMenuDefaultItem
method.
SetMenuInfo
method.
SetMenuItemBitmaps
method.
SetMenuItemInfo
method.
TrackPopupMenu
method.
Note: If you just want to display a popup menu, consider the simpler
HMENU::TrackPopupMenuAtPoint
.
Shows the popup menu anchored at the given coordinates using
TrackPopupMenu
, and performs other
needed operations.
This method will block until the menu disappears.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
Mutably borrows from an owned value. Read more