Results 1 to 5 of 5

Thread: [RESOLVED] animated cursors

  1. #1

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Resolved [RESOLVED] animated cursors

    my module can put one image in picturebox array, but something in the code isn't right. because i don't recive every animted cursors subimages.
    can anyone help me resolve these problem?

    Code:
    Option Explicit
    
    Private Declare Function LoadCursorFromFile Lib "user32" Alias _
        "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
    Private Declare Function GetCursor Lib "user32" () As Long
    Private Declare Function CopyIcon Lib "user32" (ByVal hcur As Long) As Long
    Private mlngOldCursor As Long, lngNewCursor As Long
    Private Declare Function DrawIconEx Lib "user32" (ByVal hdc As Long, ByVal xLeft As Long, ByVal yTop As Long, ByVal hIcon As Long, ByVal cxWidth As Long, ByVal cyWidth As Long, ByVal istepIfAniCur As Long, ByVal hbrFlickerFreeDraw As Long, ByVal diFlags As Long) As Long
    
    Const DI_MASK = &H1
    Const DI_IMAGE = &H2
    Const DI_NORMAL = DI_MASK Or DI_IMAGE
    
    Public Sub AnimatedCursor(AniFilePath As String, picDestany As Variant)
        Static i As Long
        Dim e As Long
        If picDestany.Count > 1 Then
            For e = 1 To picDestany.Count
                Unload picDestany
            Next e
        End If
        'Create a copy of the current cursor,    'for Windows NT compatibility
        mlngOldCursor = CopyIcon(GetCursor())
        'Check the passed string, if it contains
        'a solid file path, then load the cursor
        'from file. If not, add the App.Path,    '*then* load cursor...
        If InStr(1, AniFilePath, "\") Then
            lngNewCursor = LoadCursorFromFile(AniFilePath)
        Else
            lngNewCursor = LoadCursorFromFile(App.Path & _
                "\" & AniFilePath)
        End If        'Activate the cursor
        If i > 1 Then Load picDestany(i)
        DrawIconEx picDestany(i).hdc, 0, 0, lngNewCursor, 0, 0, 0, 0, DI_NORMAL
        i = i + 1
    End Sub
    thanks
    VB6 2D Sprite control

    To live is difficult, but we do it.

  2. #2

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: animated cursors

    the answer is in API section of the forum... thanks
    VB6 2D Sprite control

    To live is difficult, but we do it.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [RESOLVED] animated cursors

    Where?

    Post a link.

  4. #4

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: [RESOLVED] animated cursors

    Last edited by joaquim; May 4th, 2008 at 06:52 AM.
    VB6 2D Sprite control

    To live is difficult, but we do it.

  5. #5
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: [RESOLVED] animated cursors

    Quote Originally Posted by Hack
    Where?

    Post a link.
    here in the API area
    Last edited by Edgemeal; May 4th, 2008 at 08:37 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width