Happens when the user moves the mouse pointer over your window, or clicks the mouse button while the mouse is over your window. The purpose of this event is to allow you to tell the operating system upon which part of the window the user has the mouse (ie, the title bar, menu bar, close box, inner area, etc).


Args

ARG(1) is where the operating system believes the mouse is located. It is one of the following values:

Value Meaning
0 Mouse is not over your window.
1 Over the inner (client).
2 Over the title bar.
3 Over the system menu.
4 Over the restore button in the title bar.
5 Over the menu bar.
6 Over the horizontal scroll bar.
7 Over the vertical scroll bar.
8 Over the minimize button.
9 Over the maximize button.
10 Over the left border.
11 Over the right border.
12 Over the top border.
13 Over the top left corner (where the window can be resized).
14 Over the top right corner.
15 Over the bottom border.
16 Over the bottom left corner.
17 Over the bottom right corner.
18 Over a border that doesn't allow resizing the window.
19 Over some object in the window.
20 Over the close box in the title bar.
21 Over the context help (question mark) button in the title bar.
-1 Over a transparent part of the window.

ARG(2) is the X position where the mouse pointer is currently located (referenced from the upper left corner of the desktop screen), and ARG(3) is the Y position.


Return

You must return one of the above values to tell the operating system where the mouse is. For example, you can force the close box to be ignored by doing the following:

Everytime an NCHITTEST event happens where ARG(1) = 20 (ie, the operating system thinks that the mouse is over the close box), you can instead return the value 1 (ie, fool the operating system into considering the mouse to be over the inner area of your window).