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
There are no comments yet. Be the first to comment!