PowerBASIC Information Center Tutorials
These tutorials were written to help you get a quick, but thorough, understanding of PowerBASIC -
the scope of the language as well as it's specific capabilities.
Mouse Function Summary
Changing the shape of the mouse cursor is the only built-in PowerBASIC
function related to controlling the mouse.
Otherwise, responding to mouse events via the CallBack function is the
primary approach PowerBASIC programmers use to respond to user
Client Area Messages
These messages are sent to windows when a mouse event (press or release) occurs
within the window's client area.
The x/y coordinates of the mouse hot spot are in the low-order/hi-order word, respectively,
area. The system posts the WM_MOUSEMOVE message to the window when the user moves the cursor within the client area.
WM_CAPTURECHANGED - sent to window losing mouse capture
WM_MOUSEACTIVATE - set top-level window as active
WM_MOUSEHOVER - hovers over the client area for a certain time period
WM_MOUSEHWHEEL - detects movement of mouse wheel
WM_MOUSELEAVE - leaves the client area
WM_MOUSEMOVE - moves within the client area
WM_MOUSEWHEEL - detects movement of mouse wheel
WM_NCHITTEST - determines if mouse event was in client/non-client area
Non-Client Area Messages
A window also receives a message when a mouse event occurs in the window,
but outside the client area - border, menu bar, title bar, scroll bar,
window menu, minimize button, and maximize button.
These non-client messages are generated primarily for use by Windows. There is
a corresponding non-client area mouse message for each client area mouse message.
Windows supports a mouse with 5 buttons. in addition to the left, middle, and
right buttons there are XBUTTON1 and XBUTTON2, which provide backward and forward
navigation when internet browsers.
These messages are provided:
WM_XBUTTONDBLCLK - client area
WM_XBUTTONDOWN - client area
WM_XBUTTONUP - client area
WM_NCXBUTTONDBLCLK - non-client area
WM_NCXBUTTONDOWN - non-client area
WM_NCXBUTTONUP - non-client area
The HIWORD of the WPARAM in these messages contains a flag indicating which X button
Capturing Mouse Events
Most programmer effort related to mouse control takes place in a Callback
Function, responding to mouse events.
The properties of a mouse depends on the software drivers
supporting the mouse. The Control Panel/Mouse applet is typically
used to make changes to the action of the mouse, such as
button configurations, pointer options, wheel features and set
Here's an example of the MOUSEPTR statement.
- MOUSEPTR - sets the mouse pointer to a new shape
MOUSEPTR iStyle& TO iResult& 'TO is optional
iResult is set to zero if the operation fails, or to a handle
for the old cursor if it succeeds. The handle may be used to restore
the cursor by using it in place of iStyle&
iStyle options are:
0 - Hide
1 - Arrow
2 - Cross
3 - I-Beam
4 - Arrow
5 - Sizing pointer (all directions)
6 - Sizing pointer (NE-SW diagonal)
7 - Sizing pointer (vertical)
8 - Sizing pointer (NW-SE diagonal)
9 - Sizing pointer (horizontal)
10 - Up arrow
11 - Hourglass
12 - No mouse pointer
13 - App Starting (arrow with an hourglass)
If you have any suggestions or corrections, please let me know.