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?
thanksCode: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





Reply With Quote