如何在程序中实现动态鼠标?

解决方案 »

  1.   

    FORM1.MousePointer = 99
    FORM1.MouseIcon = LoadPicture(App.Path + "\XXX.ICO")
      

  2.   

    动态鼠标的文件的扩展名为   *.ani
    怎样调用此类文件??
      

  3.   

    不行,自定义鼠标只能用ico
    除非系统是用ani,然后使用系统光标
      

  4.   

    Option ExplicitPrivate 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 cmdRestoreCursor_Click()
        Dim hCur As Long
        
        hCurOld = SetClassLong(Form1.hwnd, GCL_HCURSOR, hCur)
    End SubPrivate Sub Form_Load()
        Dim hCur As Long
        
        hCur = LoadCursorFromFile(app.path+"\metronom.ani")
        hCurOld = SetClassLong(Form1.hwnd, GCL_HCURSOR, hCur)
    End Sub
      

  5.   

    Option Explicit
    Private Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
    Private Declare Function DestroyCursor Lib "user32" (ByVal hCursor As Long) As Long
    Private Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Private Const GCL_HCURSOR = (-12)Dim AniCur As Long
    Private Sub Form_Load()
        AniCur& = LoadCursorFromFile(App.Path & "\Neko.ani")
        SetClassLong Me.hwnd, GCL_HCURSOR, AniCur
    End SubPrivate Sub Form_Unload(Cancel As Integer)
        DestroyCursor AniCur
    End Sub
      

  6.   

    Option Explicit
    '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ' API declare
    Private Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
    Private Declare Function DestroyCursor Lib "user32" (ByVal hCursor As Long) 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 declare
    Private Const GCL_HCURSOR = (-12)
    '
    Dim AniCur As Long
    '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Private Sub Form_Load()
        AniCur& = LoadCursorFromFile(App.Path & "\Neko.ani")
        SetClassLong Me.hwnd, GCL_HCURSOR, AniCur
    End SubPrivate Sub Form_Unload(Cancel As Integer)
        DestroyCursor AniCur
    End Sub
      

  7.   

    Option Explicit
    '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ' API declare
    Private Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
    Private Declare Function DestroyCursor Lib "user32" (ByVal hCursor As Long) 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 declare
    Private Const GCL_HCURSOR = (-12)
    '
    Dim AniCur As Long
    '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Private Sub Form_Load()
        AniCur& = LoadCursorFromFile(App.Path & "\Neko.ani")
        SetClassLong Me.hwnd, GCL_HCURSOR, AniCur
    End SubPrivate Sub Form_Unload(Cancel As Integer)
        DestroyCursor AniCur
    End Sub