by Emporer (4 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 9th November 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Makes a form vibrate.
API Declarations
Create a new project and add a command button to the form then copy the code into the form. Play around with the numbers in the button event to change the way it vibrates.
Vibrate Form1, 100, 30
End Sub
Private Sub Form_Unload(Cancel As Integer)
End
End Sub
Public Sub Pause(ms)
secs = ms / 1000
G = Timer
Do While Timer - G < secs: DoEvents: Loop
End Sub
Public Sub Vibrate(frm As Form, rScale As Integer, Times As Integer)
Dim Lft As Long, Tp As Long
Lft = frm.Left
Tp = frm.Top
For i = 1 To Times
frm.Move Lft + Sgn(rScale)
Pause 20
frm.Move Lft + rScale
Pause 20
frm.Move Lft, Tp + Sgn(rScale), frm.Width, frm.Height
Pause 20
frm.Move Lft, Tp + rScale, frm.Width, frm.Height
Pause 20
Next i
End Sub