Date: 02-16-2022
Return to Index
created by gbSnippets
'Here is a list of messages related to mouse activity. The wParam/lParam content of the
'messages is provided further down this page. Be sure to read the .API of interest
'snippet. The API provides means of accessing mouse information WITHOUT using the
'messages listed below.
'While the list seems long, notice that about half of them relate to non-client (NC) area events.
' Client Area Non-Client Area Miscellaneous
------------------ --------------------- -------------------
WM_LBUTTONDBLCLK WM_NCLBUTTONDBLCLK WM_MOUSEMOVE
WM_LBUTTONDOWN WM_NCLBUTTONDOWN WM_NCMOUSEMOVE
WM_LBUTTONUP WM_NCLBUTTONUP WM_NCHITTEST
WM_MBUTTONDBLCLK WM_NCMBUTTONDBLCLK WM_MOUSEACTIVATE
WM_MBUTTONDOWN WM_NCMBUTTONDOWN WM_CAPTURECHANGED
WM_MBUTTONUP WM_NCMBUTTONUP WM_MOUSEHOVER
WM_RBUTTONDBLCLK WM_NCRBUTTONDBLCLK WM_NCMOUSEHOVER
WM_RBUTTONDOWN WM_NCRBUTTONDOWN WM_MOUSELEAVE
WM_RBUTTONUP WM_NCRBUTTONUP WM_NCMOUSELEAVE
WM_XBUTTONDBLCLK WM_NCXBUTTONDBLCLK WM_MOUSEWHEEL
WM_XBUTTONDOWN WM_NCXBUTTONDOWN WM_MOUSEHWHEEL
WM_XBUTTONUP WM_NCXBUTTONUP
'These next messages are not under MOUSE in MSDN, but still supply information
'regarding mouse action.
WM_SETCURSOR WM_ACTIVATEAPP WM_COMMAND
WM_PARENTNOTIFY WM_CHILDACTIVATE WM_NOTIFY
WM_SYSCOMMAND
'MOUSE
WM_LButtonDown : WM_RButtonDown : WM_MButtonDown : WM_XButtonDown
WM_LButtonUp : WM_RButtonUp : WM_MButtonUp : WM_XButtonUp
- 'user releases/presses the left/right/middle/X mouse Button While the cursor is in the Client area of a Window.
'If the mouse is Not captured, the message is posted to the Window beneath the cursor.
'Otherwise, the message is posted to the Window that has captured the mouse.
WM_LButtonDblClk : WM_RButtonDblClk : WM_MButtonDblClk : WM_XLButtonDblClk :
- 'user double-clicks the left/right/middle/X mouse Button While the cursor is in the Client area of a Window.
'If the mouse is Not captured, the message is posted to the Window beneath the cursor.
'Otherwise, the message is posted to the Window that has captured the mouse.
WM_MouseMove (NC) - 'when the cursor moves (if mouse input is NOT captured). posted to Window containing the cursor
WM_NCHitTest - 'when mouse moves, mouse pressed, mouse released
WM_MouseActivate - 'when the cursor is in an inactive Window AND the user presses a mouse Button.
WM_CaptureChanged - 'sent to Window losing mouse capture
WM_MouseHover (NC) - 'when cursor hovers over client area for specified time afer using TrackMouseEvent
WM_MouseLeave (NC) -''when cursor leaves the client area for specified time afer using TrackMouseEvent
WM_MouseWheel -' when the wheel is rotated
WM_MouseHWheel -' when the horizontal scroll wheel is tilted rotated
'CURSOR
WM_SetCursor - 'when the cursor moves
'WINDOWS
WM_ParentNotify - 'when a child created/destroyed, user clicks over a child window
WM_ActivateAPP -'when window of different app than active window is about to be activated
WM_ChildActivate -' when child windows title bar is clicked, or window activated/moved/sized
'KEYBOARD ACCELERATORS
WM_SysCommand - 'selection from Window Menu/System Menu/Control Menu, Maximize Button,
'Minimize Button, Restore Button, Close Button.
'MENUS
WM_Command -'selects menu, sends notification msg to parent, accelerator keystroke
'GENERAL CONTROLS
WM_Notify -'when event has occurred or the control requires information
'And finally, here are the wParam/lParm makeup of the messages.
-----------------------------------------------------
WM_MouseMove ' w virtual keys(s): Ctrl Shft, LRMXButtons
' l Lo x (client)
' Hi y (client)
-----------------------------------------------------
WM_NCMouseMove ' w HitTest
' l xy in PT structure (screen)
-----------------------------------------------------
WM_NCHitTest ' w ---
' l Lo x (screen)
' Hi y (screen)
' rtn position of cursor hot spot (see MSDN list of equates)
-----------------------------------------------------
WM_MouseActivate ' w hParent
' l Lo HitTest
' Hi Mouse Msg ID
-----------------------------------------------------
WM_CaptureChanged ' w ---
' l hWnd of Window gaining the mouse capture
-----------------------------------------------------
WM_MouseHover ' w virtual keys(s): Ctrl Shft, LRMXButtons
' l Lo x (client)
' Hi y (client)
-----------------------------------------------------
WM_NCMouseHover ' w HitTest
' l xy in PT structcure (screen)
-----------------------------------------------------
WM_MouseLeave ' w ---
' l ---
-----------------------------------------------------
WM_NCMouseLeave ' w ---
' l ---
-----------------------------------------------------
WM_MouseWheel ' w Lo virtual keys(s): Ctrl Shft, LRMXButtons
' Hi distance wheel rotated, in multiples of 120, can be +/-
' l Lo x (screen)
' Hi y (screen)
-----------------------------------------------------
WM_MouseHWheel ' w Lo virtual keys(s): Ctrl Shft, LRMXButtons
' Hi distance wheel rotated, in multiples of 120, can be +/-
' l Lo x (screen)
' Hi y (screen)
'These are in MSDN under CURSOR, not MOUSE
-----------------------------------------------------
WM_SetCursor ' w hWnd of Windows containing the cursor
' l Lo HitTest
' Hi Mouse Msg Id
'These are in MSDN under WINDOWS, not MOUSE
-----------------------------------------------------
WM_ParentNotify ' w wm_LMRXButton wm_create, wm_destroy
' l Lo x (client) handle of child window
' Hi y (client)
-----------------------------------------------------
WM_ActivateApp ' w True-being activate False-being deactivated
' l Thread corresponding to wParam value
-----------------------------------------------------
WM_ChildActivate ' w ---
' l ---
'These are in MSDN under KEYBOARD ACCELERATORS, not MOUSE
-----------------------------------------------------
WM_SysCommand ' w constant specifying the command requested
' l Lo x (screen) - applies only if selected with mouse (not key accel)
' Hi y (screen) - value is -1/0 depending on non-mouse selection method
'These are in MSDN under KEYBOARD ACCELERATORS, not MOUSE
-----------------------------------------------------
WM_Command ' w Lo Control ID (CB.Ctl)
' Hi Notification code (CB.CtlMsg)
' l hControl
'Note: wParam/lParam values shown are for WM_Command that occurs as a notification message.
' values are not shown for WM_Command that occurs for menu/accelerator action
'These are in MSDN under GENERAL CONTROL, not MOUSE
-----------------------------------------------------
WM_Notify ' w Lo Control ID (Cb.NMCtl)
' Hi ---
' l pointer to NMHDR
'gbs_00205
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm