|
-
Apr 16th, 2001, 04:08 AM
#1
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?
-
Apr 16th, 2001, 04:38 AM
#2
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!
-
Apr 16th, 2001, 06:15 AM
#3
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
-
Apr 16th, 2001, 06:25 AM
#4
Or you can use the vbNewLine constant.
-
Apr 16th, 2001, 06:49 AM
#5
tnx, both of you.
Matthew, how can i retrieve the text so it reads as 1 line?
SetCursorPos <----> 1st line in Text1
-
Apr 16th, 2001, 07:04 AM
#6
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.
-
Apr 16th, 2001, 07:06 AM
#7
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
-
Apr 16th, 2001, 01:13 PM
#8
Thanks alot.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|