CheckMenuItem Function

CheckMenuItem Function

The CheckMenuItem function sets the state of the specified menu item's check-mark attribute to either selected or clear.


Syntax

    DWORD CheckMenuItem(      
        HMENU hmenu,
        UINT uIDCheckItem,
        UINT uCheck
    );

Add an item to Explorer Shell context (right-click) menu easily – How to add them ?

 

 

 Add items to Explorer context menu with the Windows Explorer Shell Context Menu

 

  Insert items to Explorer Shell context menu easily with Windows Explorer Shell Context Menu. This powerful .Net component for your own, custom items appending to Windows Explorer Shell context menu will append all your application entries to Windows Explorer Shell context menu. This .Net component and Visual Basic .NET support include detailed C# and VB.NET samples, tutorials and support all you may need to add your entries to Explorer context menu :

  • Add all your items to Windows Explorer Shell context menu to be shown on any Windows computer (all OS are supported – Windows XP, Vista, x64 , etc.)
  • Add all your items to Windows Explorer Shell context menu to be shown in any way - with custom caption and your custom icon, as separator or sub-menu
  • Add your items to Explorer context menu to be shown for all files or shown only for computer files of particular type (for example, only for .DOC , .MP3,.WMA,.AAC , .MPG files)
  • Add your program items to Windows Explorer Shell context menu, sub-menus, sub-sub-menus, sub-menus of unlimited depth and even much more


Explorer Shell Context Menu - is a powerful .Net component that support all you may need to insert your items to Explorer context menu - in a fast and easy way. Add your entries to Windows Explorer Shell context menu right now – add entries to context menu fast and exactly as you prefere :

 Add entries To the Explorer Context Menu easily with Windows Explorer Shell Context Menu

 

CheckMenuItem Function Description

CheckMenu Item if a WinAPI function used to add an item to Explorer Shell context menu on old Windows OS, but because this CheckMenuItem function works only for Windows 95 / Windows 98 (not on XP, Vista, x64 - 64-bit Windows), to add items to Windows Explorer Shell context menu you should use, according to Microsoft guidelines, appropriate .Net component - Windows Explorer Shell Context Menu.  How to add an item to Windows Explorer Shell context menu? The best answer on all questions related to custom items appending to Windows Explorer right-click context menu is a Context Menu .Net Component, the leading solution for custom items appending to Windows Explorer Shell context menu.

 

Parameters

    hmenu
        [in] Handle to the menu of interest.
    uIDCheckItem
        [in] Specifies the menu item whose check-mark attribute is to be set, as determined by the uCheck parameter.
    uCheck
        [in] Specifies flags that control the interpretation of the uIDCheckItem parameter and the state of the menu item's check-mark attribute. This parameter can be a combination of either MF_BYCOMMAND, or MF_BYPOSITION and MF_CHECKED or MF_UNCHECKED.

        MF_BYCOMMAND
            Indicates that the uIDCheckItem parameter gives the identifier of the menu item. The MF_BYCOMMAND flag is the default, if neither the MF_BYCOMMAND nor MF_BYPOSITION flag is specified.
        MF_BYPOSITION
            Indicates that the uIDCheckItem parameter gives the zero-based relative position of the menu item.
        MF_CHECKED
            Sets the check-mark attribute to the selected state.
        MF_UNCHECKED
            Sets the check-mark attribute to the clear state.


Return Value

    The return value specifies the previous state of the menu item (either MF_CHECKED or MF_UNCHECKED). If the menu item does not exist, the return value is -1.


Remarks

    Note  The CheckMenuItem function has been superseded by the SetMenuItemInfo function. You can still use CheckMenuItem, however, if you do not need any of the extended features of SetMenuItemInfo.

    An item in a menu bar cannot have a check mark.

    The uIDCheckItem parameter identifies a item that opens a submenu or a command item. For a item that opens a submenu, the uIDCheckItem parameter must specify the position of the item. For a command item, the uIDCheckItem parameter can specify either the item's position or its identifier.


Example

    For an example, see Simulating Check Boxes in a Menu.


Function Information

    Minimum DLL Version    user32.dll
    Header    Declared in Winuser.h, include Windows.h
    Import library    User32.lib
    Minimum operating systems    Windows 95, Windows NT 3.1
    Unicode    Implemented as Unicode version.