|
|
|
|
|
Dicas
|
|
Visual Basic (Mouse/Teclado)
|
|
|
Título da Dica: Usando cursores animados e coloridos no vb
|
|
|
|
Postada em 3/6/2003 por X-Crow
Private Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long 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 GCL_HCURSOR = (-12) Const IDC_SIZEALL = 32646& Const IDC_ARROW = 32512& Private CabeçalhoCursorSist As Long, CabeçalhoCursor1 As Long, CabeçalhoCursor2 As Long Private Sub Form_Load() 'Carrega um cursor padrão CabeçalhoCursor1 = LoadCursor(ByVal 0&, IDC_ARROW) 'Carrega um arquivo de cursor CabeçalhoCursor2 = LoadCursorFromFile("C:\Windows\Cursors\banana.ani") ' Pode ser qq cursor animado(.ani) ou até mesmo cursores coloridos... 'Muda o cursor do mouse do formulário CabeçalhoCursorSist = SetClassLong(Me.hwnd, GCL_HCURSOR, CabeçalhoCursor1) 'Muda o cursor do botão CabeçalhoCursorSist = SetClassLong(Command1.hwnd, GCL_HCURSOR, CabeçalhoCursor2) End Sub Private Sub Form_Unload(Cancel As Integer) 'Muda o cursor atual para o cursor original SetClassLong Me.hwnd, GCW_HCURSOR, CabeçalhoCursorSist 'Libera os recursos de User32 DestroyCursor CabeçalhoCursor1 DestroyCursor CabeçalhoCursor2 End Sub
|
|
|
|
|