Click to See Complete Forum and Search --> : Using animated cursors


dammansky
September 17th, 2001, 09:30 AM
Hi can anybody help me on using animated cursors in my program??

Iouri
September 17th, 2001, 09:52 AM
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


Iouri Boutchkine
iouri@hotsheet.com

dammansky
September 17th, 2001, 10:00 AM
Thank u verry much for this reply, but i need this in a label_mousemove event. Can you help me with this??

Cimperiali
September 17th, 2001, 10:17 AM
'then add this code in general section:
dim blnload as boolean

'and use Iouri code in different events:
private Sub label1_mousemove()
Dim hCur as Long
if blnload= false then

hCur = LoadCursorFromFile("c:\winnt\cursors\metronom.ani")
hCurOld = SetClassLong(Form1.hwnd, GCL_HCURSOR, hCur)
blnload = true
end if
End Sub

private Sub Form_mousemove
Dim hCur as Long
if blnload = true then
hCur = SetCursor(hCurOld)
blnload = false
end if
End Sub






Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.

The Rater