Click to See Complete Forum and Search --> : Using Animated Cursors
softweng
June 18th, 2001, 04:35 PM
Can you use animated cursors with the Screee.MouseIcon property?
I know how to use whatever cursor you want using the LoadPicture function or using a resource
file. But I would like to use Animated Cursors as well (*.ani).
Has anyone ever done this or have any ideas?
Thanks!!!
Kris
Software Engineer
Phoenix,AZ
Tower
June 18th, 2001, 07:33 PM
private Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (byval lpFileName as string) as Long
private Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (byval hwnd as Long, byval nIndex as Long, byval dwNewLong as Long) as Long
Const GCL_HCURSOR = (-12)
Dim hCurOld as Long
private Sub Form_Load()
Dim hCur as Long
hCur = LoadCursorFromFile("c:\winnt\cursors\metronom.ani")
hCurOld = SetClassLong(Form1.hwnd, GCL_HCURSOR, hCur)
End Sub
private Sub Form_Unload(Cancel as Integer)
Dim hCur as Long
hCur = SetCursor(hCurOld)
End Sub
Cimperiali
June 19th, 2001, 02:59 AM
You deserve a ten, but I am out of votes...!
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
softweng
June 25th, 2001, 01:35 PM
Thank you for the code. It works great.
What is the code for the SetCursor function?
It is called in the Form_Unload event but I don't
know what the code is so I get an error.
Kris
Software Engineer
Phoenix,AZ
Tower
June 25th, 2001, 07:09 PM
Delete all Form_Unload code. Sorry, this is only test SetCursor function. This function not working in VB and i found other way to create cursor.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.