The WM_CONTEXTMENU message notifies a window that the user clicked the right mouse button (right clicked) in the window.
hwnd = (HWND) wParam;
xPos = LOWORD(lParam);
yPos = HIWORD(lParam);
No return value.
A window can process this message by displaying a shortcut menu using the TrackPopupMenu or TrackPopupMenuEx function.
If a window does not display a shortcut menu it should pass this message to the DefWindowProc function. If a window is a child window, DefWindowProc sends the message to the parent. Otherwise, DefWindowProc displays a default shortcut menu if the specified position is in the window's caption.
DefWindowProc generates the WM_CONTEXTMENU message when it processes the WM_RBUTTONUP or WM_NCRBUTTONUP message.
Windows NT: Requires version 3.51 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in winuser.h.
Menus Overview, Menu Messages, DefWindowProc, TrackPopupMenu, TrackPopupMenuEx, WM_NCRBUTTONUP, WM_RBUTTONUP