delphi,用delphi制作类似按键精灵的功能

//以前用XP,使用按键精灵还是不错的,但至从换成64位的win7平台后,按键精灵9在不开启神盾的情况下无法启动脚本。

//为了能在64位的win7下继续使用类似按键精灵的功能,现改用delphi来制作,最大的好处是灵活,而且不收费

delphi,用delphi制作类似按键精灵的功能

//以下内容为网络上摘抄,暂时还未验证,如有同类爱好的朋友可以共同探讨

unit kbKernel;

interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
type
  pRGBTripleArray = ^TRGBTripleArray;
  TRGBTripleArray = ARRAY[0..32767] OF TRGBTriple;
  TRGBTriple = 
  PACKED RECORD
    rgbtBlue : BYTE;
    rgbtGreen: BYTE;
    rgbtRed : BYTE;
  END;

  procedure CloseWindows;
  procedure LeftClick(x, y: integer);
  procedure RightClick(x, y: integer);
  procedure DoubleClick(x, y: integer);
  procedure MoveTo(x, y: integer);
  procedure Presskey(vk: integer);
  procedure PressTwoKey(key1, key2: integer);
  function GetPixelColor(x, y: integer): integer;
  function Findcolor(iLeft, iTop, iRight, iBottom, Acolor: integer;
    var iX, iY: integer):boolean;
  function Findpicture(iLeft, iTop, iRight, iBottom: integer;
    strPic: string; var iX, iY: integer):boolean;
  procedure inputNum(num:integer);
  function GetXY(var x, y: integer): boolean;

implementation

procedure CloseWindows();
var
 hdlProcessHandle : Cardinal;
 hdlTokenHandle : Cardinal;
 tmpLuid : Int64;
 //tkpPrivilegeCount : Int64;
 tkp : TOKEN_PRIVILEGES;
 tkpNewButIgnored : TOKEN_PRIVILEGES;
 lBufferNeeded : Cardinal;
 Privilege : array[0..0] of _LUID_AND_ATTRIBUTES;
begin
  hdlProcessHandle := GetCurrentProcess;
  OpenProcessToken(hdlProcessHandle,
                 (TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY),
                  hdlTokenHandle);

  // Get the LUID for shutdown privilege.
  LookupPrivilegeValue('', 'SeShutdownPrivilege', tmpLuid);
  Privilege[0].Luid := tmpLuid;
  Privilege[0].Attributes := SE_PRIVILEGE_ENABLED;
  tkp.PrivilegeCount := 1;   // One privilege to set
  tkp.Privileges[0] := Privilege[0];
  // Enable the shutdown privilege in the access token of this
  // process.
  AdjustTokenPrivileges(hdlTokenHandle,
                       False,
                       tkp,

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值