From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I use a custom .cur file as the mouse cursor?

I created my own cursor in a graphics app and I want to use it to indicate a mode/state to the user. I have tried to use the Win32 SDK functions, i.e. LoadCursorFromFile, GetCursor, Set Cursor, and CopyCursor to no avail. I'm having a problem setting the registered window cursor to NULL. I use GetCursor to get the current cursor handle, then set it to NULL, i.e. cursorhandle = NULL;. Then I use the handle for my custom cursor that I obtained with LoadCursorFromFile in the SetCursor function. But I am still having a problem getting the custom cursor to remain after the mouse is moved. What am I doing wrong?
I'm attaching the cursor file for artistic merit.
0 Kudos
Message 1 of 2
(2,944 Views)
Here's a very short sample that works :

HCURSOR hCursor;

hCursor = LoadCursorFromFile( va_psFile );
if( hCursor==NULL )
return FALSE;

SetCursor( hCursor );
ShowCursor( TRUE );
Message 2 of 2
(2,944 Views)