USUÁRIO:      SENHA:        SALVAR LOGIN ?    Adicione o VBWEB na sua lista de favoritos   Fale conosco 

 

  Dicas

  Visual Basic    (Mouse/Teclado)

Título da Dica:  Fazer movimentos e gravar as coordenadas do mouse
Postada em 2/1/2002 por Rodrigo S. Lima      Clique aqui para enviar email para o autor  trumpetista@hotmail.com
Private Declare Function GetCursorPos Lib "user32" (ipPoint As POINTAPI) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private vstop As Boolean
***********************Gravar as Coordenadas****************
Private Sub CommandButton1_Click()
CommandButton1.Enabled = False
CommandButton3.Enabled = False
CommandButton2.Enabled = True
Dim x As Integer
x = 1
Dim mouse As POINTAPI
Open "C:\mouse.mov" For Output As #1
Do Until vstop = True
GetCursorPos mouse
Write #1, mouse.x
Write #1, mouse.y
Label1.Caption = mouse.x
Label2.Caption = mouse.y
DoEvents
Loop
Close #1
End Sub
************************************************************
Private Sub CommandButton2_Click()
CommandButton1.Enabled = True
CommandButton2.Enabled = False
CommandButton3.Enabled = True
vstop = True
End Sub
****************************Abre as Coordenadas Antigas********
Private Sub CommandButton3_Click()
CommandButton1.Enabled = False
CommandButton2.Enabled = False
CommandButton3.Enabled = False
Dim mouse As POINTAPI
Dim corde As POINTAPI
corde.x = Label1.Caption
corde.y = Label2.Caption
vstop = False
Open "C:\mouse.mov" For Input As #1
Do Until vstop = True
If EOF(1) Then Exit Do
Input #1, mousex
Input #1, mousey
GetCursorPos mouse
Label1.Caption = mouse.x
Label3.Caption = mouse.y
SetCursorPos mousex, mousey
DoEvents
Loop
Close #1
CommandButton2_Click
MsgBox "Fim de apresentação", vbExclamation, "Mouse MOve"
SetCursorPos corde.x, corde.y
End Sub
********************************Pega as Coordenadas************
Private Sub UserForm_Activate()
Dim mouse As POINTAPI
Do
GetCursorPos mouse
Label1.Caption = mouse.x
Label2.Caption = mouse.y
DoEvents
Loop
End Sub

By Rodrigo S. Lima
trumpetista@hotmail.com
 


CyberWEB Network Ltda.    © Copyright 2000-2024   -   Todos os direitos reservados.
Powered by HostingZone - A melhor hospedagem para seu site
Topo da página