|
|
|
|
|
Dicas
|
|
Visual Basic (Forms/MDI)
|
|
|
Título da Dica: Mude o cursor do mouse dentro e fora de sua app
|
|
|
|
Postada em 25/11/2003 por PC
'******************************* '********* EM UM MODULE ******** '******************************* Option Explicit Private Declare Function LoadCursorFromFile Lib "user32" Alias _ "LoadCursorFromFileA" (ByVal lpFileName As String) As Long Private Declare Function SetSystemCursor Lib "user32" _ (ByVal hcur As Long, ByVal id As Long) As Long Private Declare Function GetCursor Lib "user32" () As Long Private Declare Function CopyIcon Lib "user32" (ByVal hcur As Long) As Long Private Const OCR_NORMAL = 32512 Public mlngOldCursor As Long, lngNewCursor As Long Public Declare Function GetTickCount Lib "kernel32" () As Long Public Sub StartAnimatedCursor(AniFilePath As String) mlngOldCursor = CopyIcon(GetCursor()) If InStr(1, AniFilePath, "\") Then lngNewCursor = LoadCursorFromFile(AniFilePath) Else lngNewCursor = LoadCursorFromFile(App.Path & _ "\" & AniFilePath) End If SetSystemCursor lngNewCursor, OCR_NORMAL End Sub Public Sub RestoreLastCursor() SetSystemCursor mlngOldCursor, OCR_NORMAL End Sub
Private Sub Command1_Click() '******************************* '* EM UM FORM CRIE UM BOTÃO *** '* E DESENHE UM COMMONDIALOG *** '******************************* 'GERALMENTE OS CURSORES ENTÃOS DENTRO DE c:\windows\cursor Dim lngCounter As Long Dim lngStart As Long Dim lngNow As Long On Error GoTo ErrHandler CommonDialog1.Filter = "Cursor de mouse animado (*.ANI)|*.ANI|" CommonDialog1.FilterIndex = 2 CommonDialog1.ShowOpen StartAnimatedCursor (CommonDialog1.FileName) lngStart = GetTickCount() Do Until lngNow - lngStart > 3000 DoEvents lngNow = GetTickCount() Loop RestoreLastCursor Exit Sub ErrHandler: Exit Sub End Sub
|
|
|
|
|