Reputation: 139
Here is the code I'm using:
HCURSOR hCrossHair;
...
hCrossHair = LoadCursorFromFile( "ColorTool_CrossHair.cur" );
...
SetSystemCursor( hCrossHair, OCR_NORMAL );
Is there a way of setting the cursor so it overrides all others? For example, if I specify OCR_NORMAL
in SetSystemCursor
then it only replaces the general arrow (default) cursor, but as soon as the mouse is over a text field somewhere or the edge of a re-sizable window, etc, it changes to the usual cursor for those situations.
I've also tried
SetSystemCursor( hCrossHair, OCR_NORMAL );
SetSystemCursor( hCrossHair, OCR_IBEAM );
SetSystemCursor( hCrossHair, OCR_SIZE );
but that it appears only one of the calls (usually the first one) will be applied.
Thanks for any advise.
Upvotes: 0
Views: 1620
Reputation: 596156
It replaces the contents of the system cursor specified by the id parameter with the contents of the cursor specified by the hcur parameter and then destroys hcur.
That means you have to re-load, or make a copy of, the cursor every time you want to call SetSystemCursor()
.
Also keep in mind that this will only replace system cursors, not user-defined cursors that are manually assigned to the VCL's TScreen::Cursors[]
property after app startup.
Upvotes: 2