Ya-Zahra
Ya-Zahra

Reputation: 11

Delphi: capture live frame of animated mouse cursor

Windows supports animated mouse cursors and I want to take a snapshot of all mouse cursor frames live, that is: I want to know exactly which frame of the cursor is being displayed to the user at the moment x (milliseconds is also important). It is essential that the frame index is extracted correctly. I use the DrawIconEx function for this purpose.

What exists to figure out exactly which frame is being displayed right now?

Upvotes: 1

Views: 202

Answers (1)

Ian Boyd
Ian Boyd

Reputation: 256711

I am going to say that this is not possible.

  • i've never seen anything like it
  • i've never heard of anything like it
  • and it sounds like a feature that would never exist

Your best alternative is to what programs like AutoCAD, Photoshop, and many games do:

Draw the cursor yourself

  • hide the cursor in your form: ShowCursor(False);
  • track every WM_MOUSEMOVE
  • Get the cursor position: GetCursorPos(point)
  • and then draw a cursor yourself

Your other alternative is to constantly replace the cursor in your app with a custom cursor - with only one image in it:

cursorHandle := LoadImage(0, IDC_WAIT, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE or LR_SHARED);
Screen.Cursors[crWait] := cursorHandle;

Now you know exactly what image the cursor is currently showing, because you loaded it.

Upvotes: 1

Related Questions