SendMessage(Myhwnd, WM_KEYDOWN, VK_TAB, 1); // 发送Tab键
SendMessage(Myhwnd, WM_KEYUP, VK_TAB, 1);
SendMessage(Myhwnd, WM_KEYDOWN, VK_RETURN, 1); // 发送Enter键
SendMessage(Myhwnd, WM_KEYUP, VK_RETURN, 0);
SendMessage(Myhwnd, WM_LBUTTONDOWN, 0, MakeLParam(292, 179)); //移动到坐标292,179并点击
SendMessage(Myhwnd, WM_LBUTTONUP, 0, MakeLParam(292, 179));
SendMessage(Hwnd, WM_LBUTTONDBLCLK, 0, MakeLParam(175, 277)); //模拟双击
SendMessage(Hwnd, WM_LBUTTONUP, 0, MakeLParam(175, 277));
Str := '123456';
for I := 1 to Length(Str) do // 发送数字123456
SendMessage(Han, WM_CHAR, wParam(Str[I]), 1);
Procedure FindQQ(hWnd: Thandle; Str: String);
Var
I: Integer;
Begin
for I := 1 to Length(Str) do // 发送数字123456
Begin
PostMessage(hWnd, WM_KEYDOWN, 0, 1);
PostMessage(hWnd, WM_CHAR, wParam(Str[I]), 1);
PostMessage(hWnd, WM_KEYUP, 0, 1);
End;
End;
SwitchToThisWindow(RichEditComponent, true);
FindQQ(RichEditComponent, '/140');
keybd_event(VK_CONTROL, MapVirtualKey(VK_CONTROL, 0), 0, 0); // 按下 Ctrl键
keybd_event(VK_CONTROL, MapVirtualKey(VK_CONTROL, 0), KEYEVENTF_KEYUP, 0);
SetCursorPos(40, 48); //移动鼠标位置到 X40、Y48
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); //单击 左键
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
{前台模拟英文字母输入}
Var
i: integer;
Begin
for i := 1 to Length(A) do
Begin
Keybd_Event(VkKeyScan(A[i]), 0, 0, 0);
Keybd_Event(VkKeyScan(A[i]), 0, KEYEVENTF_KEYUP, 0);
End;
{后台发送中文}
Var
Str: String;
Begin
Str := '2020-11-09 ,我爱我家';
//方法一
SendMessage(69474,EM_REPLACESEL,0,Integer(pchar(Str)));
//方法二
SendMessage(69474,WM_SETTEXT,0,Cardinal(Str));
End;