Win95 的动画鼠标为应用程序增色不少,而 VB 则只提供一般的鼠标图标支持。要用 VB 显示动画鼠标形状,你可以使用以下方法:


函数声明:

Public Const GCL_HCURSOR = -12

Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long

Declare Function DestroyCursor Lib "user32" (ByVal hCursor As Any) As Long

Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal

lpFileName As String) As Long

Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hwnd As Long,

ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Declare Function GetClassLong Lib "user32" Alias "GetClassLongA" (ByVal hwnd As Long,

ByVal nIndex As Long) As Long

使用:

Dim mhBaseCursor As Long, mhAniCursor As Long

Dim lResult As Long

mhAniCursor = LoadCursorFromFile("c:\windows\cursors\appstart.ani")

lResult = SetClassLong((hwnd), GCL_HCURSOR, mhAniCursor)