windows_programming_notes.nbk: Home | Index | Next Page: WM_INITMENUPOPUP | Previous Page: WM_INITDIALOG


 WM_INITMENU

The WM_INITMENU message is sent when a menu is about to become active. It occurs when the user clicks an item on the menu bar or presses a menu key. This allows the application to modify the menu before it is displayed.

A window receives this message through its WindowProc function.

    LRESULT CALLBACK WindowProc(
      HWND hwnd,       // handle to window
      UINT uMsg,       // WM_INITMENU
      WPARAM wParam,   // handle to menu (HMENU)
      LPARAM lParam    // not used
    );

Parameters

Return Values

If an application processes this message, it should return zero.

Remarks

A WM_INITMENU message is sent only when a menu is first accessed; only one WM_INITMENU message is generated for each access. For example, moving the mouse across several menu items while holding down the button does not generate new messages. WM_INITMENU does not provide information about menu items.

Requirements

  Windows NT/2000 or later: Requires Windows NT 3.1 or later.
  Windows 95/98/Me: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

windows_programming_notes.nbk: Home | Index | Next Page: WM_INITMENUPOPUP | Previous Page: WM_INITDIALOG


Notebook exported on Monday, 7 July 2008, 18:56:50 PM Eastern Daylight Time