pub unsafe fn enable_menuitem(h: HMENU, pos: Option<UINT>, id: Option<UINT>, enabled: bool) {
    use winapi::um::winuser::{MENUITEMINFOW, MIIM_STATE, MFS_DISABLED, MFS_ENABLED};
    use winapi::um::winuser::{SetMenuItemInfoW, GetMenuItemCount};
    use winapi::shared::minwindef::BOOL;
    
    let use_position = id.is_none();
    let choice = if use_position { pos } else { id };
    let value = match choice {
        Some(p) => p,
        None => (GetMenuItemCount(h) - 1) as u32
    };

    let state = match enabled {
        true => MFS_ENABLED,
        false => MFS_DISABLED
    };

    let mut info = MENUITEMINFOW { 
        cbSize: mem::size_of::<MENUITEMINFOW>() as UINT,
        fMask: MIIM_STATE, fType: 0, fState: state,
        wID: 0, hSubMenu: ptr::null_mut(), hbmpChecked: ptr::null_mut(),
        hbmpUnchecked: ptr::null_mut(), dwItemData: 0, dwTypeData: ptr::null_mut(),
        cch: 0, hbmpItem: ptr::null_mut()
    };

    SetMenuItemInfoW(h, value, use_position as BOOL, &mut info);
}
/**
    Enable or disable a menuitem at the selected position or using the selected ID. If the position is None and id is None, the last item is selected.
*/
Enable or disable a menuitem at the selected position or using the selected ID. If the position is None and id is None, the last item is selected.
Enable or disable a menuitem at the selected position or using the selected ID . If the position is None and id is None the last item is selected .
pub unsafe fn enable_menuitem(h: HMENU, pos: Option<UINT>, id: Option<UINT>, enabled: bool) {
    use winapi::um::winuser::{MENUITEMINFOW, MIIM_STATE, MFS_DISABLED, MFS_ENABLED};
    use winapi::um::winuser::{SetMenuItemInfoW, GetMenuItemCount};
    use winapi::shared::minwindef::BOOL;
    let use_position = id.is_none();
    let choice = if use_position { pos } else { id };
    let value = match choice {
        Some(p) => p,
        None => (GetMenuItemCount(h) - 1) as u32
    };
    let state = match enabled {
        true => MFS_ENABLED,
        false => MFS_DISABLED
    };
    let mut info = MENUITEMINFOW { 
        cbSize: mem::size_of::<MENUITEMINFOW>() as UINT,
        fMask: MIIM_STATE, fType: 0, fState: state,
        wID: 0, hSubMenu: ptr::null_mut(), hbmpChecked: ptr::null_mut(),
        hbmpUnchecked: ptr::null_mut(), dwItemData: 0, dwTypeData: ptr::null_mut(),
        cch: 0, hbmpItem: ptr::null_mut()
    };
    SetMenuItemInfoW(h, value, use_position as BOOL, &mut info);
}
pub unsafe fn enable_menuitem ( h : HMENU , pos : Option < UINT > , id : Option < UINT > , enabled : bool ) { use winapi :: um :: winuser :: { MENUITEMINFOW , MIIM_STATE , MFS_DISABLED , MFS_ENABLED } ; use winapi :: um :: winuser :: { SetMenuItemInfoW , GetMenuItemCount } ; use winapi :: shared :: minwindef :: BOOL ; let use_position = id . is_none ( ) ; let choice = if use_position { pos } else { id } ; let value = match choice { Some ( p ) => p , None => ( GetMenuItemCount ( h ) - 1 ) as u32 } ; let state = match enabled { true => MFS_ENABLED , false => MFS_DISABLED } ; let mut info = MENUITEMINFOW { cbSize : mem :: size_of :: < MENUITEMINFOW > ( ) as UINT , fMask : MIIM_STATE , fType : 0 , fState : state , wID : 0 , hSubMenu : ptr :: null_mut ( ) , hbmpChecked : ptr :: null_mut ( ) , hbmpUnchecked : ptr :: null_mut ( ) , dwItemData : 0 , dwTypeData : ptr :: null_mut ( ) , cch : 0 , hbmpItem : ptr :: null_mut ( ) } ; SetMenuItemInfoW ( h , value , use_position as BOOL , & mut info ) ; }
Enable or disable a menuitem at the selected position or using the selected ID.
Enable or disable a menuitem at the selected position or using the selected ID .
h
HMENU
pos
Option<UINT>
id
Option<UINT>
enabled
bool