Results 1 to 8 of 8

Thread: Toughie...?

  1. #1
    Mage15Specialty
    Guest

    Question

    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?

  2. #2
    TheSarlacc
    Guest
    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!

  3. #3
    Matthew Gates
    Guest
    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

  4. #4
    Matthew Gates
    Guest
    Or you can use the vbNewLine constant.

  5. #5
    Mage15Specialty
    Guest
    tnx, both of you.

    Matthew, how can i retrieve the text so it reads as 1 line?

    SetCursorPos <----> 1st line in Text1

  6. #6
    Matthew Gates
    Guest
    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.

  7. #7
    Matthew Gates
    Guest
    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

  8. #8
    Mage15Specialty
    Guest
    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
  •  



Click Here to Expand Forum to Full Width