Custom mouse pointer handling?

BlitzMax Forums/BlitzMax Programming/Custom mouse pointer handling?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Here is a C example how to load your own cursors

just Import the c file and make the Extern things to
call the functions. ( and change the c source to
load your own cursor pics )


#include <windows.h>

#define    CUR_DEFAULT     0
#define    CUR_RESIZE      1
#define    CUR_DRAW        2
#define    CUR_LINE        3
#define    CUR_POLY        4
#define    CUR_RECT        5
#define    CUR_CIRCLE      6
#define    CUR_SPRAY       7
#define    CUR_FILL        8
#define    CUR_GETBRUSH    9
#define    CUR_TEXT        10
#define    CUR_ZOOM        11
#define    CUR_GETCOLOR    12
#define    CUR_WAIT        13

HCURSOR g_cur[15];
HWND g_cur_hwnd;
unsigned int g_cur_class;

/*========================================================================
   
 ========================================================================*/
void CursorLoad ( HWND hwnd )
{
   g_cur_hwnd = hwnd;
   g_cur[CUR_DEFAULT] = LoadCursor (0, IDC_ARROW );
   g_cur[CUR_RESIZE] = LoadCursor (0, IDC_SIZE );
   g_cur[CUR_DRAW] = LoadCursorFromFile ( "default.cur" );
   g_cur[CUR_LINE] = LoadCursorFromFile ( "line.cur" );
   g_cur[CUR_POLY] = LoadCursorFromFile ( "poly.cur" );
   g_cur[CUR_RECT] = LoadCursorFromFile ( "rect.cur" );
   g_cur[CUR_CIRCLE] = LoadCursorFromFile ( "circle.cur" );
   g_cur[CUR_SPRAY] = LoadCursorFromFile ( "spray.cur" );
   g_cur[CUR_FILL] = LoadCursorFromFile ( "fill.cur" );
   g_cur[CUR_GETBRUSH] = LoadCursorFromFile ( "getbrush.cur" );
   g_cur[CUR_TEXT] = LoadCursorFromFile ( "text.cur" );
   g_cur[CUR_ZOOM] = LoadCursorFromFile ( "zoom.cur" );
   g_cur[CUR_GETCOLOR] = LoadCursorFromFile ( "getcolor.cur" );
   g_cur[CUR_WAIT] = LoadCursorFromFile ( "wait.ani" );

   g_cur_class = GetClassLong ( g_cur_hwnd, GCL_HCURSOR );
   SetClassLong ( g_cur_hwnd, GCL_HCURSOR, 0 );
}


/*========================================================================
   
 ========================================================================*/
void CursorSet ( int cnum )
{
   SetCursor ( g_cur[cnum] );
}


/*========================================================================
   
 ========================================================================*/
void CursorShutdown ( void )
{
   int loop;

   SetClassLong ( g_cur_hwnd, GCL_HCURSOR, g_cur_class );

   for (loop = 0; loop < 12; loop++ ) 
   {
       DestroyCursor ( g_cur[loop] );
   }
}