HCURSOR, animated or static? (Repost)
-
I posted this same question two days ago but have so far not gotten an answer. I am assuming that there is no way to do what I want, but I will ask again just in case someone who does know missed my question the first time. Given an HCURSOR handle, how can one tell if it is an animated cursor (loaded from an .ani file or RT_ANICURSOR resource) or not?
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!
-
I posted this same question two days ago but have so far not gotten an answer. I am assuming that there is no way to do what I want, but I will ask again just in case someone who does know missed my question the first time. Given an HCURSOR handle, how can one tell if it is an animated cursor (loaded from an .ani file or RT_ANICURSOR resource) or not?
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!
-
The theory is not bad, but unfortunately it does not work. ExtractIcon and ExtractIconEx are used to retrieve icons from a file (.exe, .dll, or .ico), not from an HICON or HCURSOR handle. I am writing a wrapper class around HCURSOR, and there are some things that I can do with a static cursor that I can not do with an animated one, such as compare them to see if they are the same or change the location of the hotspot. Being able to tell if an HCURSOR is animated or not would be handy.
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!
-
The theory is not bad, but unfortunately it does not work. ExtractIcon and ExtractIconEx are used to retrieve icons from a file (.exe, .dll, or .ico), not from an HICON or HCURSOR handle. I am writing a wrapper class around HCURSOR, and there are some things that I can do with a static cursor that I can not do with an animated one, such as compare them to see if they are the same or change the location of the hotspot. Being able to tell if an HCURSOR is animated or not would be handy.
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!
Then why don't you try the DrawIconEx and set the istepIfAniCur member to something greater than 0. I'm sure the function would fail if it's not an animated cursor.
-
Then why don't you try the DrawIconEx and set the istepIfAniCur member to something greater than 0. I'm sure the function would fail if it's not an animated cursor.
From MSDN:
istepIfAniCur
[in] Specifies the index of the frame to draw, if hIcon identifies an animated cursor.
This parameter is ignored if hIcon does not identify an animated cursor.But I will try it anyway:^)
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!
-
I posted this same question two days ago but have so far not gotten an answer. I am assuming that there is no way to do what I want, but I will ask again just in case someone who does know missed my question the first time. Given an HCURSOR handle, how can one tell if it is an animated cursor (loaded from an .ani file or RT_ANICURSOR resource) or not?
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!
Do not use the CopyCursor function for animated cursors. Instead, use the CopyImage function. I'm wondering if CopyCursor returns an error if you pass it an animated cursor? Montreal great Guy Lafleur, quoted by CBC on being mugged while vacationing recently in Buenos Aires: "I didn't have any time to react before I got a sucker-punch in the eye. It was like one of the players from the Bruins."
-
Then why don't you try the DrawIconEx and set the istepIfAniCur member to something greater than 0. I'm sure the function would fail if it's not an animated cursor.
I might be able to make this work, if I draw frame zero and frame one and then compare them. If they are different I got an animated cursor, if they are the same I got a static cursor. Seems like a really bad hack but until something better comes along:sigh:
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!
-
Do not use the CopyCursor function for animated cursors. Instead, use the CopyImage function. I'm wondering if CopyCursor returns an error if you pass it an animated cursor? Montreal great Guy Lafleur, quoted by CBC on being mugged while vacationing recently in Buenos Aires: "I didn't have any time to react before I got a sucker-punch in the eye. It was like one of the players from the Bruins."
Jack Squirrel wrote:
I'm wondering if CopyCursor returns an error if you pass it an animated cursor?
No error, it just creates a static cursor containing the first frame of the animated cursor.
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!