小弟手邊有一片"觸控面板",我用RS-232硬體來控制觸控面板,目前可以讀到MOUSE座標X,Y,但我點選"開始"鈕時,開始鈕會一直重覆,就像是滑鼠連續 按,放,按,放 的情形,我該怎麼修改,才能點下去'開始"只按一下呢?
Case comEvReceive  ' 收到 RThreshold # of Data

If Comm1.InBufferCount Then
InByte = Comm1.Input
   For i = LBound(InByte) To UBound(InByte)
   
   If Hex(InByte(i)) = 99 Then  '判斷是否按下,若是99則為按下
    For j = 1 To 2
     Select Case j
     Case 1
          X22 = X20 / 1024 * axis_x   'X軸座標
     Case 2     
          Y22 = Y20 / 1024 * axis_y  'Y軸座標
          SetCursorPos X22, Y22
          mouse_event 2, X22, Y22, 0, 0  'left mouse down              
      End Select
     Next j
   End If

If Hex(InByte(i)) = 98 Then  '判斷是否抬起
    For j = 1 To 2
     Select Case j
     Case 1
          X22 = X20 / 1024 * axis_x   'X軸座標
     Case 2     
          Y22 = Y20 / 1024 * axis_y  'Y軸座標
          SetCursorPos X22, Y22
                       
          mouse_event 4, X2222, Y2222, 0, 0 'left mouse up 
     End Select             
    Next j
  End If
 Next i
End If

全站熱搜

vbqa 發表在 痞客邦 留言(2) 人氣()