by dheeren patel (1 Submission)
Category: Windows API Call/Explanation
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Thu 17th January 2002
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
"dancing mouse pointer" within the form & also new style of caption and flashnig label
API Declarations
'THIS IS JUST FOR FUN U MAY USE IT IN DIFFERENT WAY
'MAIL ME YR COMMENTS AT [email protected]
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Dim xx As Integer
Dim yy As Integer
Dim a As Integer
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Dim sh As Integer
Dim sw As Integer
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Dim s As String
Dim s1 As String
Dim l As Integer
'take one command button named cmddance one label named lblinfo and a timer named timer1 with interval 100
'press esc to stop
'set form's name dance.
Timer1.Enabled = True
xx = Rnd * 10 + 1
yy = Rnd * 10 + 1
End Sub
Private Sub cmddance_KeyDown(KeyCode As Integer, Shift As Integer)
If vbKeyEscape Then
Timer1.Enabled = False
dance.Caption = s
End If
End Sub
Private Sub Form_Load()
s = "DANCING POINTER BY DHEEREN PATEL"
l = 1
End Sub
Private Sub Timer1_Timer()
Dim pp As POINTAPI
GetCursorPos pp
sh = (Screen.Height / 15) - 1
sw = (Screen.Width / 15) - 1
If pp.x <= 0 Then xx = -xx
If pp.x >= sw Then xx = -xx
If pp.y <= 0 Then yy = -yy
If pp.y >= sh Then yy = -yy
DoEvents
pp.x = pp.x + xx
pp.y = pp.y + yy
SetCursorPos pp.x, pp.y
lblinfo.ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
s1 = Left(s, l)
dance.Caption = s1
l = l + 1
If l >= Len(s) + 3 Then
l = 1
s1 = ""
End If
End Sub
No comments have been posted about dancing mouse pointer within the form & also new style of caption and flashnig label. Why not be the first to post a comment about dancing mouse pointer within the form & also new style of caption and flashnig label.