主题:请教sendkeys的问题
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Const MOUSEEVENTF_MOVE = &H1 ' mouse move
Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Private Const MOUSEEVENTF_ABSOLUTE = &H8000 ' absolute move
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal Scan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Const KEYEVENTF_KEYUP = &H2 '释放按键常数
Private Sub Timer1_Timer()
Dim posx, posy
posx = Text5.Text '移动鼠标选择
posy = Text6.Text
a = SetCursorPos(posx, posy)
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_LEFTDOWN, posx, posy, 0, 0
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_LEFTUP, posx, posy, 0, 0
Call keybd_event(49, 0, 0, 0) '按下1键
Call keybd_event(49, 0, KEYEVENTF_KEYUP, 0) '释放1键
Call keybd_event(54, 0, 0, 0) '按下6键
Call keybd_event(54, 0, KEYEVENTF_KEYUP, 0) '释放6键
如何逐行读取文本文件内容
用sendkeys方法发送
读完第一行后读第二行,没有就停止
比如文本文件内容为:
123
456
789
请高手写段看看,非常感谢
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Const MOUSEEVENTF_MOVE = &H1 ' mouse move
Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Private Const MOUSEEVENTF_ABSOLUTE = &H8000 ' absolute move
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal Scan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Const KEYEVENTF_KEYUP = &H2 '释放按键常数
Private Sub Timer1_Timer()
Dim posx, posy
posx = Text5.Text '移动鼠标选择
posy = Text6.Text
a = SetCursorPos(posx, posy)
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_LEFTDOWN, posx, posy, 0, 0
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_LEFTUP, posx, posy, 0, 0
Call keybd_event(49, 0, 0, 0) '按下1键
Call keybd_event(49, 0, KEYEVENTF_KEYUP, 0) '释放1键
Call keybd_event(54, 0, 0, 0) '按下6键
Call keybd_event(54, 0, KEYEVENTF_KEYUP, 0) '释放6键
如何逐行读取文本文件内容
用sendkeys方法发送
读完第一行后读第二行,没有就停止
比如文本文件内容为:
123
456
789
请高手写段看看,非常感谢