TTouchKeyboard:将击键发送到其他程序吗? [英] TTouchKeyboard: send keystroke to other program?

查看:103
本文介绍了TTouchKeyboard:将击键发送到其他程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Delphi中使用TTouchKeyboard,以便它可以将击键发送到其他程序。例如,我想使用TTouchKeyboard组件在浏览器中键入密码。我不知道如何在单击键盘时使浏览器保持焦点。

How do I use TTouchKeyboard in Delp so it could send keystrokes to other program. For example, I want to type password in a browser using TTouchKeyboard component. I have no idea how make the browser stay focus while I'm clicking on my keyboard.

推荐答案

TTouchKeyboard 将键发送到当前控件焦点:因此,如果您具有 TEdit focus ,则TEdit将接收密钥...

TTouchKeyboard sends the keys to the current control focused: so if you have a TEdit with the focus, the TEdit will receive the key...

您可以创建一个包含 TTouchKeyboard 的表单,并添加以下过程:

You can create a form which contains the TTouchKeyboard and add this procedure:

  protected
    procedure CreateParams(var Params: TCreateParams); override;

...

procedure TForm1.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  with Params do
  begin
    ExStyle   := ExStyle or WS_EX_NOACTIVATE;
    WndParent := GetDesktopwindow;
  end;
end;

您的表单无法获得焦点...因此,密钥被发送到前一个焦点控制。 (我刚刚对其进行了测试,它的工作原理是:密钥已发送到此网页)

Your form can't have the focus... so, the key is sent to the previous focused control. (I have just tested it and it works: the key has been sent to this webpage)

这篇关于TTouchKeyboard:将击键发送到其他程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆