Situar el cursor encima de un determinado control (p. ej.: un botón)


Truco de Visual Basic 6.0 - Situar el cursor encima de un determinado control (p. ej.: un botón)


Escribir el código siguiente en el módulo:

Declare Sub SetCursorPos Lib "User32" (ByVal X As Integer, ByVal Y As Integer)

Insertar un botón en el formulario y escribir el siguiente código:

Private Sub Form_Load()
X% = (Form1.Left + Command1.Left + Command1.Width / 2 + 60) / Screen.TwipsPerPixelX
Y% = (Form1.Top + Command1.Top + Command1.Height / 2 + 360) / Screen.TwipsPerPixelY
SetCursorPos X%, Y%
End Sub


Pon el truco en tus favoritos Pon el truco en tus favoritos