Displaying Animated Cursors from a Resource File
Posted
by Bernd Wi_ler
on January 22nd, 2000
After I could not locate a method for displaying animated cursors from a resource, I found a way myself.
Essentially (with error checking removed), here's the code path.
HCURSOR LoadAnimatedCursor(UINT nID
{
HINSTANCE hInst=AfxGetInstanceHandle();
HRSRC hRes=FindResource(hInst,MAKEINTRESOURCE(nID),"ANICURSORS");
DWORD dwSize=SizeofResource(hInst,hRes);
HGLOBAL hGlob=LoadResource(hInst,hRes);
LPBYTE pBytes=(LPBYTE)LockResource(hGlob);
return (HCURSOR)CreateIconFromResource(pBytes,dwSize,FALSE,0x00030000);
}
To import an .ANI file to the resource script:
- Insert->Resource->Import: Load the .ANI file
- Select the new resource into a user defined type named: ANICURSORS

Comments
The effect seems to be unavailable on Win32 application
Posted by Legacy on 12/19/2003 12:00amOriginally posted by: Grant
What can I do to make it apply also to Win32 application
Replynot just on dialog? Thanx.
1 solution, 1 problem
Posted by Legacy on 03/02/2002 12:00amOriginally posted by: Sibilant
ReplyLOL, better solution then paying ...
Posted by Legacy on 01/08/2002 12:00amOriginally posted by: az
man It is stupid to pay for a thing that works on one operationg system better then the one on which it isnt working ... it is better to get Windows NT from a friend then paying for such a thing...or get Windows XP, it is something like win98+winNT ... it is working on it:)
Reply
This function returns NULL
Posted by Legacy on 01/27/2000 12:00amOriginally posted by: Dennis Woo
Hi,
I traced the codes and every lines looked fine except that the return value for the function is zero. Furthermore GetLastError() gave me zero.
Any ideas why?
Thanks.
Regards
Reply