1

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?

AmigoJack
  • 5,234
  • 1
  • 15
  • 31
Ya-Zahra
  • 11
  • 4

1 Answers1

1

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.

Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
  • Thank you for your answer, but I am designing a software to take photos and videos of everything the user sees on the desktop, so your alternative method does not work for me. I want to capture everything the user sees (even pointer shadows and pointer trails, as well as pointer location indicator circles if they are active and visible to the user). Look at the mouse settings in the Windows control panel. – Ya-Zahra Apr 08 '22 at 14:18
  • @MED In that case you can't get that **exactly**. The closest technique suggested [here](https://stackoverflow.com/a/48925443/12597) and [here](https://stackoverflow.com/a/23012752/12597) is to first capture the desktop, then use `GetCursorInfo`, `GetIconInfo`, `DrawIconEx` to draw the icon onto your previous screencapture. But that can only draw the first frame of the icon. – Ian Boyd Apr 08 '22 at 19:16
  • Thank you again sincerely, but this is not my problem. As far as you mentioned, I have fully implemented it in Delphi. My problem is animated cursors and extracting and discovering the frame number being displayed to the user. – Ya-Zahra Apr 08 '22 at 22:03