-
Im making a program that records the mouse movements and plays them back.......
Private Sub Timer1_Timer()
Dim PT As POINTAPI
GetCursorPos PT
Text1.Text = Text1.Text & "(" & PT.X & "," & PT.Y & ")"
End Sub
The text in Text1 appears like this.......
(156,150)(156,150)(156,150)(141,157)(127,157)(127,157)(127,157)(127,157)(131,147)(131,147)(131,147)( 131,147)(131,147)(131,147)(131,147)(131,147)(131,147)(131,147)
in one textbox. All this is good, but i need to somehow take every individual (156,150) / (???,???) and some how get it read as a single (???,???) so it can be read / playd back.
Any suggestions or ideas?
-
as well as putting into a txtbox, why dont u store the x and y values in seperate arrays, so that u can recall them easy!
-
Use the Carriage Return/Line Feed constant (vbCrLf).
Code:
Private Sub Timer1_Timer()
Dim PT As POINTAPI
GetCursorPos PT
Text1.Text = Text1.Text & "(" & PT.X & "," & PT.Y & ")" & vbCrLf
End Sub
-
Or you can use the vbNewLine constant.
-
tnx, both of you.
Matthew, how can i retrieve the text so it reads as 1 line?
SetCursorPos <----> 1st line in Text1
-
Use the Split function.
Code:
Dim vArray As Variant
vArray = Split(Text1.Text, vbCrLf)
Msgbox vArray(0) '1st line
Msgbox vArray(1) '2nd line
Msgbox vArray(2) '3rd line
'etc.
'etc.
-
Say for example you wish to put all the coords in a listbox.
Code:
Dim vArray As Variant
Dim iArray As Integer
vArray = Split(Text1.Text, vbCrLf)
For iArray = LBound(vArray) To UBound(vArray)
List1.AddItem vArray(iArray)
Next iArray
-