# Function Reference

# _GUICtrlMenu_SetMenuStyle

Sets the menu style

#include <GuiMenu.au3>
_GUICtrlMenu_SetMenuStyle ( $hMenu, $iStyle )

## Parameters

$hMenu | Handle of the menu
$iStyle | Style of the menu. It can be one or more of the following values: $MNS_AUTODISMISS - Menu automatically ends when mouse is outside the menu for 10 seconds $MNS_CHECKORBMP - The same space is reserved for the check mark and the bitmap $MNS_DRAGDROP - Menu items are OLE drop targets or drag sources $MNS_MODELESS - Menu is modeless $MNS_NOCHECK - No space is reserved to the left of an item for a check mark $MNS_NOTIFYBYPOS - Menu owner receives a WM_MENUCOMMAND message instead of a WM_COMMAND message for selections

## Return Value

Success: | True.
Failure: | False.

## Remarks

$MNS_NOTIFYBYPOS is a menu header style and has no effect when applied to individual sub menus.

## Related

_GUICtrlMenu_GetMenuStyle

## Example

    #include "Extras\HelpFileInternals.au3"

    #include <GuiMenu.au3>

    Global $g_hWnd

    Example()

    Func Example()
        Local $hMain, $hFile

        ; Open Notepad
        Run("notepad.exe")
        $g_hWnd = ("[CLASS:Notepad]")
        $hMain = _GUICtrlMenu_GetMenu($g_hWnd)
        $hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

        ; Get/Set File menu style
        Writeln("File menu style: 0x" & Hex(_GUICtrlMenu_GetMenuStyle($hFile)))
        _GUICtrlMenu_SetMenuStyle($hFile, $MNS_NOCHECK)
        Writeln("File menu style: 0x" & Hex(_GUICtrlMenu_GetMenuStyle($hFile)))

        _NotepadForceClose($g_hWnd)
    EndFunc   ;==>Example

    ; Write a line of text to Notepad
    Func Writeln($sText, $hWnd = $g_hWnd)
        ControlSend($hWnd, "", ControlGetFocus($hWnd), $sText & @CRLF)
    EndFunc   ;==>Writeln