[转载]让VB使用彩色及动画光标的方法-基础教程
VB本身不支持彩色光标和动画光标,但可以通过调用Windows的API函数实现这一目的。这里用到两个API函数,LoadCursorFromFile用于装入新光标(xin),需要指明新光标的具体路径及文件名;SetClassLong用于设置使用新光标(xin)。这一函数使用时会返回一个代表前一个光标的变量值(jiu),为我们关闭程序时得以方便的恢复原始光标(jiu)
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
Dim xin As Long
Dim jiu As Long
Private Sub Form_Load()
xin = LoadCursorFromFile("C:WINDOWSCURSORSGlobe.ani")
jiu = SetClassLong(hwnd, -12, xin)
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
SetClassLong hwnd, -12, jiu
End Sub