Colored Cursors on MS Windows


I am creating a puzzle game for Windows using SDL. So far everything went very
smoothly, but now I am stuck while trying to implement a colored mouse cursor.

I know that SDL officially only supports b/w cursors, but I do not require
cross-plattform compatibility, nor do I need hardware acceleration. So a
regular windows cursor will suffice. I would not want to hide the SDL cursor
and blit the mousecursor myself because that makes the mouse feel quite laggy
on slow systems.

So far I tried setting the mouse cursor via the windows API:
the following:

//load a windows cursor cursor resource
HCURSOR hCursor = (HCURSOR)LoadImage(NULL,CursorPath.c_str
//set the cursor globally.

This works, but only for a brief moment, before SDL seems to notice what has
been happening and resets the cursor to the previous look.

I thought it might have to do with the following behaviour described in the
windows manual:

If your application must set the cursor while it is in a window, make sure the class cursor for the specified window's class is set to NULL. If the class cursor is not NULL, the system restores the class cursor each time the mouse is moved.

So I tried the following as well:

//Set the main window’s caption
//get a handle to the main window
HWND MainWindowHandle=FindWindow(NULL,“MyGame”);

//set the window’s class cursor to NULL, so it does not revert
//to the sdl cursor as soon as the mouse is moving

//load a windows cursor cursor resource
HCURSOR hCursor = (HCURSOR)LoadImage(NULL,CursorPath.c_str
//set the cursor globally.

Unfortunately this did not seem to have any different effect either.

Is there any kind of hack (again: I really don’t care about cross-plattform
compatibility at the moment) that would allow me to set a colored windows
cursor? I had a look at the SDL sources, but could not figure out how to do it.


Adrian Grigore