匿名用户
1级
2011-09-04 回答
模拟鼠标如下:
1、这里是鼠标左键按下和松开两个事件的组合即一次单击:
mouse_event (MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 )
2、模拟鼠标右键单击事件:
mouse_event (MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0 )
3、两次连续的鼠标左键单击事件 构成一次鼠标双击事件:
mouse_event (MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 )
mouse_event (MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 )
4、使用绝对坐标
MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, 500, 500, 0, 0
模拟键盘输入如下:
void EnterString(const char* text)
{
bool bShift = false;
size_t length = strlen(text);
for(size_t index = 0;index < length;index++)
{
int val = text[index];
if(val >= 97 && val <= 122) //小写a-z
{
v