小编Mat*_*ttB的帖子

如何以编程方式按键与键盘上按键完全相同?

有没有人知道如何以编程方式按键,就像在键盘上按下键一样?PostMessage失败,SendInput失败,keybd_event失败,SendMessage失败,我甚至尝试使用Vcl.Touch.Keyboard模仿按键的不寻常方式.我甚至写了一个快速的vb脚本文件调用sendkeys也失败了.我在一个名为Sellerdeck http://www.sellerdeck.com/的程序中尝试这样做时遇到了麻烦

我已经尝试了以下所有内容,它们都与记事本配合使用,但在此程序中失败了.窗口成功地被带到了forground

procedure bringToForegroung;
Var
findhandle1 : cardinal;
begin
findhandle1 := FindWindow(NIL, 'Business Plus - Test site: Online Catalogue');
ShowWindow(findhandle1,SW_SHOW);
SetForegroundWindow(findhandle1);
end;
Run Code Online (Sandbox Code Playgroud)

1.

procedure SendF10;
Var
findhandle1 : cardinal;
begin
findhandle1 := FindWindow(NIL, 'Business Plus - Test site: Online Catalogue');
ShowWindow(findhandle1,SW_SHOW);
SetForegroundWindow(findhandle1);
PostMessage(findhandle1, WM_KEYDOWN, VK_F10, 0);
PostMessage(findhandle1, WM_KEYUP, VK_F10, 0);
end;
Run Code Online (Sandbox Code Playgroud)

2.

 procedure SendAltF;
var
  KeyInputs: array of TInput;
  //--------------------------------------------
  procedure KeybdInput(VKey: Byte; Flags: DWORD);
  begin
    SetLength(KeyInputs, Length(KeyInputs)+1);
    KeyInputs[high(KeyInputs)].Itype := INPUT_KEYBOARD;
    with  KeyInputs[high(KeyInputs)].ki do
    begin
      wVk := VKey; …
Run Code Online (Sandbox Code Playgroud)

delphi vbscript

7
推荐指数
1
解决办法
1723
查看次数

标签 统计

delphi ×1

vbscript ×1