请教:如何用VB编程模拟人来操作其他应用程序
我最近想编个程序模拟人的操作从PDM系统中自动查找数据,例如自动移动鼠标到搜索文本框并模拟鼠标单击左键激活文本框,再将要搜索的文本粘贴到文本框里,然后再移动鼠标点击“搜索”按钮,然后从弹出的检索界面里拷贝出找到的结果。也就是用程序来模拟人的操作。求教高手指点指点。
貌似很麻烦的样子。。
LZ可以用mouse_event API函数来模拟鼠标。
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_ABSOLUTE = &H8000 ' absolute move
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_RIGHTDOWN = &H8 ' right button down
Private Const MOUSEEVENTF_RIGHTUP = &H10 ' right button up
Private Const MOUSEEVENTF_MIDDLEDOWN = &H20 ' middle button down
Private Const MOUSEEVENTF_MIDDLEUP = &H40 ' middle button up。