i have found out how to track the mouse and the click of the mouse when it is over the for, how can i track it outside the form? also how do i record it and the timing of when keys are pressed? i need to make this program so that it will test out my friends simple game he made, he wants me to see if the high score will roll over at so much, so i was hoping i could make this record the actions once and it would repeat it to get the score up.

Recommended Answers

All 2 Replies

Massage as needed.

Private Sub Timer1_Timer()
    Dim dc, pnt As POINTAPI, str As String, colr
    Dim YesAll As Boolean
    Dim desktop_handle As Long
    
    If Enab = True Then
        desktop_handle = GetDesktopWindow()
        dc = GetWindowDC(desktop_handle)
        GetCursorPos pnt
        colr = GetPixel(dc, pnt.x, pnt.y)
        ReleaseDC desktop_handle, dc
        
        str = ""
        YesAll = True
        
        If Form1.Check1(1).Value = 1 Then
            str = "Ypos: " & Format(pnt.y, "0###")
            YesAll = False
        End If
        
        If Form1.Check1(0).Value = 1 Then
            If Form1.Check1(1).Value = 1 Then
                str = str & ", Xpos: " & Format(pnt.x, _
                    "0###")
            Else
                str = str & "Xpos: " & Format(pnt.x, "0###")
            End If
            
            YesAll = False
        End If
            
        If Form1.Check1(2).Value = 1 Then
            If Form1.Check1(1).Value = 1 Or _
                Form1.Check1(0).Value = 1 Then
                str = str & ", Color: " & Format(Hex(colr), _
                    "0#####") & Space(5)
            Else
                str = str & "Color: " & Format(Hex(colr), _
                    "0#####") & Space(5)
            End If
            
            YesAll = False
        End If
        
        If YesAll = True Then
            Form2.Visible = False
            Exit Sub
        Else
            Form2.Visible = True
        End If
        
        Form2.Label1 = str
        Form2.Width = Form2.Label1.Width + 50
        Form2.Left = (pnt.x * Screen.TwipsPerPixelX) + 100
        Form2.Top = (pnt.y * Screen.TwipsPerPixelY) + 100
    Else
        Form2.Visible = False
    End If
End Sub

ya... most of this stuff didnt work for me... i wonder if it was because i have vb 2003. do you think you could convert it to 2003?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.