Changing windows cursor

BlitzMax Forums/BlitzMax Programming/Changing windows cursor

Chroma(Posted 2007) [#1]
Anyone know how to change the windows cursor to a custom cursor using an .ico or other method? Basically have it change to your custom 32x32 icon when it's inside the BMax window.


tonyg(Posted 2007) [#2]
Hidemouse and then load an image drawn at mousex(), mousey()?


GfK(Posted 2007) [#3]
*double post*


GfK(Posted 2007) [#4]
I can't mention this enough - never ever start changing Windows settings programatically. The end-user is not going to thank you for it.

Do what TonyG says.


Damien Sturdy(Posted 2007) [#5]
Lol, so it seems, GFK- you said it twice. :P


GfK(Posted 2007) [#6]
Dunno how that happened. I only edited it. :/


Chroma(Posted 2007) [#7]
Hidemouse and then load an image drawn at mousex(), mousey()?

Erm, I'm not a newb...please read the post! I was looking for a specific method.

The code below works but sometimes you see the default cursor pop in every once in awhile. Would be cool if that could be fixed.

Graphics 800,600

?win32
	Extern "win32"
		Function LoadCursorFromFileA% (lpFileName$z)
	End Extern
?
cm=LoadCursorFromFileA( "3dgarro.cur" )

While KeyDown(KEY_ESCAPE)=False And AppTerminate()=False
Cls
SetCursor( cm )

Flip
Wend
End



tonyg(Posted 2007) [#8]
Erm, I'm not a newb...please read the post! I was looking for a specific method.

... yes, and I was suggesting a possible method which ended with a question mark to suggest, politely, if it might help you.
Anyway good luck ingrate.


Chroma(Posted 2007) [#9]
Your post stating such an obvious well-known method followed by a question mark was meant more as ridicule towards me personally than anything. Sorry but that's not polite either.

I even posted about possibly loading an .ico which clearly demonstrates I wasn't looking for the normal approach. Like I said, please read the whole post instead of responding with such utter juvenile garbage.

Ingrate eh? That just corroborates your first response as derogatory.


tonyg(Posted 2007) [#10]
Ingrate eh? That just corroborates your first response as derogatory.

No, it now just makes you a paranoid ingrate.
You've taken a post offering a reasonable suggestion and read into it a personal attack for no apparent reason.
Anyway, I still think the suggestion is a sound response to your initial post.


Chroma(Posted 2007) [#11]
No, it now just makes you a paranoid ingrate.

No, it makes you Captain Obvious lol.

Anyway, I still think the suggestion is a sound response to your initial post.


It is a sound but obvious response. That's how 99% of everyone here does it. I was exploring other methods. You clearly don't know of any other methods. Fair enough.

And yes, based on your response to my question I would be considered an ingrate. Which is an ungrateful person. Guilty as charged. :p


tonyg(Posted 2007) [#12]
... I might do but how do I know they're not obvious or ones you have already thought of?
I daren't suggest anything else although I might check how MaxGui SetPointer command does it.
Wow. It works
Graphics 800 , 600
while Not KeyHit(KEY_ESCAPE)
	SetPointer (4)
Wend



Chroma(Posted 2007) [#13]
And to load a custom .cur using maxgui?

The method I have above works but there's major tearing. You can also load animated cursors .ani but and then animate normally until you move the mouse. Then the animation starts over each pixel the mouse moves which makes the animation useless.


tonyg(Posted 2007) [#14]
Yep, by adjusting the bbsetpointer source it could probably work... good luck.
<edit> seems somebody else has been there


Chroma(Posted 2007) [#15]
If you insert LoadCursorFromFileA% (lpFileName$z ) into your user32.bmx file in your pub mod folder it will allow you to load the custom cursor. Or you could use the extern method above. I wonder if this would work:

cm = LoadCursorFromFileA("mycursor.cur")
SetPointer( cm )


EDIT: I actually found that C code yesterday but was a bit intimidated by it. I'll have another go at it I guess.


Chroma(Posted 2007) [#16]
I get an error that the c code won't compile using
Import "cursor.c"
.
EDIT: That .c code does the exact same thing as I'm doing above except in C. You still have to set the cursor each cycle, still get the tearing, flashing etc. :(


Yan(Posted 2007) [#17]
Here's a hack for 'brl.dxGraphics/d3d7Graphics.bmx' that works...