Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. HCURSOR, animated or static? (Repost)

HCURSOR, animated or static? (Repost)

Scheduled Pinned Locked Moved C / C++ / MFC
questionlearning
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • PJ ArendsP Offline
    PJ ArendsP Offline
    PJ Arends
    wrote on last edited by
    #1

    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!

    Within you lies the power for good; Use it!

    W J 2 Replies Last reply
    0
    • PJ ArendsP PJ Arends

      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!

      W Offline
      W Offline
      Waldermort
      wrote on last edited by
      #2

      A cursor is almost identical to an Icon. So in theory you should be able to use the ExtractIconEx() function to return an array of Icons. If you have more than one icon, then you are dealing with an animated cursor. Take a look here[^] for more ideas.

      PJ ArendsP 1 Reply Last reply
      0
      • W Waldermort

        A cursor is almost identical to an Icon. So in theory you should be able to use the ExtractIconEx() function to return an array of Icons. If you have more than one icon, then you are dealing with an animated cursor. Take a look here[^] for more ideas.

        PJ ArendsP Offline
        PJ ArendsP Offline
        PJ Arends
        wrote on last edited by
        #3

        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!

        Within you lies the power for good; Use it!

        W 1 Reply Last reply
        0
        • PJ ArendsP PJ Arends

          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!

          W Offline
          W Offline
          Waldermort
          wrote on last edited by
          #4

          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.

          PJ ArendsP 2 Replies Last reply
          0
          • W Waldermort

            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.

            PJ ArendsP Offline
            PJ ArendsP Offline
            PJ Arends
            wrote on last edited by
            #5

            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!

            Within you lies the power for good; Use it!

            1 Reply Last reply
            0
            • PJ ArendsP PJ Arends

              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!

              J Offline
              J Offline
              Jack Puppy
              wrote on last edited by
              #6

              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."

              PJ ArendsP 1 Reply Last reply
              0
              • W Waldermort

                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.

                PJ ArendsP Offline
                PJ ArendsP Offline
                PJ Arends
                wrote on last edited by
                #7

                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!

                Within you lies the power for good; Use it!

                1 Reply Last reply
                0
                • J Jack Puppy

                  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."

                  PJ ArendsP Offline
                  PJ ArendsP Offline
                  PJ Arends
                  wrote on last edited by
                  #8

                  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!

                  Within you lies the power for good; Use it!

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups