keybd_event模拟键盘输入密码

function TFrm_main.InputChar(str: string): Boolean;
var
  i     : integer;
  c     : byte;
begin
      for i := 1 to Length(str) do
      begin
       c := VkKeyScan(str[i]) and 255;                //输入文字
       keybd_event(c,0,0,0);
       keybd_event(c,0,KEYEVENTF_KEYUP,0);
      end;
end;

Posted in 软件开发 by 傻猫 at January 23, 2011.
Tags: 密码, 模拟输入

添加新评论