Click here to Skip to main content
15,893,668 members

System default animated cursor: How to get number of frames

chefsponk asked:

Open original thread
I want to draw the default animated cursor (hourglass in XP, circle since vista) on a form.

Theoretically, this is no problem using LoadCursor(NULL, IDC_WAIT) and DrawIconEx with the special parameter istepIfAniCur.
My problem is: How to determine the number of frames of such a system cursor (when to restart?).
The ICONINFOEX structure does not unveil this information.
I think the ICONDIR structure - the first bytes in the raw memory dump of the resource - does contain the number of images. But: How to get the raw resource data for a system / stock object.
FindResource(NULL, MAKEINTRESOURCE(IDC_WAIT), RT_CURSOR) does not help.

I hope, some MFC/Win32-Resource expert has some idea. Thanks in advance !

For all which are wondering why I sometimes refer to icons: In Win32, internally a cursor is only a special kind of icon. A icon resource (or file) contains multiple images, each for a distinct resolution/color depth. An animated cursor contains multiple "frames" which must be displayed cyclically ("thumb cinema").


PS: Why i would do this ? We have a special control displaying tasks (nested) and progresses, and we like to indicate background activity. Of course a marquee progress control could also serve as a "wait indicator", but this simple problem is just challenging me ;-)
Tags: Win32, Icon, GUI, Cursor

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900