

- PASS MOUSE COORDINATES TO BEHAVIOR CLASS HOW TO
- PASS MOUSE COORDINATES TO BEHAVIOR CLASS PLUS
- PASS MOUSE COORDINATES TO BEHAVIOR CLASS WINDOWS
For example, one might have a texture object that has a constructor and a destructor like the following: In an object-oriented language like C++, it is often useful to have a class that wraps an OpenGL Object. In case of a core extension, you should check for both the version and the presence of the extension if either is there, you can use the functionality. The correct behavior is to check for the presence of the extension if you want to use the extension API, and check the GL version if you want to use the core API. One of the possible mistakes related to this is to check for the presence of an extension, but instead using the corresponding core functions.

However, they can be useful for certain advanced functions. A typical application will not intercept these messages, because the DefWindowProc function handles these messages correctly. For example, WM_NCLBUTTONDOWN is the non-client equivalent of WM_LBUTTONDOWN.

These messages have the letters "NC" in the name. Non-client Mouse MessagesĪ separate set of messages are defined for mouse events that occur within the non-client area of the window.
PASS MOUSE COORDINATES TO BEHAVIOR CLASS WINDOWS
For example, in the Windows Shell, a single click selects a folder, while a double click opens the folder. Therefore, a double-click action should continue an action that begins with the first mouse click. Until you get the double-click message, there is no way to tell that the first mouse click is the start of a double click. Equivalent messages are defined for right, middle, and XBUTTON buttons. In effect, the second WM_LBUTTONDOWN message that would normally be generated becomes a WM_LBUTTONDBLCLK message. WM_LBUTTONDOWN WM_LBUTTONUP WM_LBUTTONDBLCLK WM_LBUTTONUP For example, a double click on the left mouse button produces the following sequence of messages: A double click is indicated by a window message with "DBLCLK" in the name. If you set the CS_DBLCLKS flag as shown, the window will receive double-click notifications. For example, to test whether the CTRL key is down: if (wParam & MK_CONTROL) The absence of a flag means the corresponding button or key was not pressed.
PASS MOUSE COORDINATES TO BEHAVIOR CLASS PLUS
The wParam parameter contains a bitwise OR of flags, indicating the state of the other mouse buttons plus the SHIFT and CTRL keys.
PASS MOUSE COORDINATES TO BEHAVIOR CLASS HOW TO
We will see how to do that in a later topic, Capturing Mouse Movement Outside the Window. Positions above and to the left of the client area have negative coordinates, which is important if you track the mouse position outside the window. Mouse coordinates are given in pixels, not device-independent pixels (DIPs), and are measured relative to the client area of the window. The macros extract the right values, so if you use them, you will be safe. In the 64-bit case, this means the low- and high-order words of the lower 32 bits. The MSDN documentation mentions the "low-order word" and "high-order word" of lParam. The upper 32 bits of lParam are not used. On 64-bit Windows, lParam is 64-bit value.

These macros are defined in the header file WindowsX.h. Use the GET_X_LPARAM and GET_Y_LPARAM macros to unpack the coordinates from lParam. The lowest 16 bits of lParam contain the x-coordinate, and the next 16 bits contain the y-coordinate. In all of these messages, the lParam parameter contains the x- and y-coordinates of the mouse pointer. For more information about client areas, see What Is a Window? Mouse Coordinates Recall that the client area is the portion of the window that excludes the frame. If the user clicks a mouse button while the cursor is over the client area of a window, the window receives one of the following messages.
