Game Development Community

[WIN]Mouse Pointer Not Visible in Title/Border Area

by David Guy · in Torque Game Builder · 03/14/2005 (1:39 am) · 0 replies

When moving mouse pointer within windows' frame/border area, the mouse pointer is not visible; active, but not visible.

I think a nice thing would be, when the pointer leaves the windows client area, to turn the custom cursor off (so it's not just sitting there motionless near the edge of the client area) and make the system cursor visible again.

Here some code that might be helpfull (under windows at least):
/*-----------------------------------------------------------------------------
	Turns tracking of mouse cursor on.

	When cursor tracking is on and the mouse cursor leaves the windows client area
	mouse tracking is automatically turned off and a WM_MOUSELEAVE message is
	generated.

	If tracking is turned on while the mouse cursor is already outside the client
	area, mouse tracking is immediately turned off and a WM_MOUSELEAVE message is
	generated.
*/
static void _set_cursor_tracking( void )
	{
_BEGIN

	if( _window_is_open )
		{
		TRACKMOUSEEVENT track_info;

		ZeroMemory( &track_info, sizeof(TRACKMOUSEEVENT) );
		track_info.cbSize    = sizeof(TRACKMOUSEEVENT);
		track_info.dwFlags   = TME_LEAVE;
		track_info.hwndTrack = _hwnd;

		if( !_TrackMouseEvent( &track_info ) ) lsyserr( "%s: _TrackMouseEvent Failed", __func__ );
		}

_END
	}

DGuy