文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>利用FindImage.dll查找图片

利用FindImage.dll查找图片

时间:2011-02-21  来源:Moodsky

View Code
 1 unit Unit1;
2
3 interface
4
5 uses
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, StdCtrls;
8
9 type
10 TForm1 = class(TForm)
11 Button1: TButton;
12 procedure Button1Click(Sender: TObject);
13 private
14 { Private declarations }
15 public
16 { Public declarations }
17 end;
18
19 var
20 Form1: TForm1;
21
22 implementation
23
24 {$R *.dfm}
25
26 procedure TForm1.Button1Click(Sender: TObject);
27 {——定义函数类型——}
28 //Left 屏幕左、上界标
29 //Top
30 //Right 屏幕右、下界标
31 //Bottom
32 //fN 图片文件名
33 //Similar 相似度,0-代表精确,建议16-20
34 //x 返回值为真,x存储屏幕x轴像素坐标
35 //y 返回值为真,y存储屏幕y轴像素坐标
36 //w fN图片文件的宽度
37 //h fN图片文件的高度
38
39 type
40 TDefined = function(Left: Integer; Top: Integer; Right: Integer; Bottom: Integer;
41 FN: Pchar; Similar: Integer; var x: Integer; var y: Integer;
42 var w: Integer; var h: Integer): Boolean; stdcall;
43
44 {——定义变量——}
45 var
46 Dll: Cardinal;
47 PFunc: TFarProc;
48 xPos, yPos, Width, Height: Integer;
49 sTime: Int64;
50
51 begin
52 sTime := Windows.GetTickCount;
53 Dll := Windows.LoadLibrary('FindImage.dll');
54 if Dll > 0 then
55 begin
56 PFunc := Windows.GetProcAddress(Dll, 'FindPic');
57 if PFunc <> nil then
58 begin
59 if TDefined(PFunc)(0, 0, 1024, 768, 'c:\a.bmp', 16, xPos, yPos, Width, Height) then
60 Windows.SetCursorPos(xPos + 10, yPos + 10);
61 end;
62 end;
63 Windows.FreeLibrary(Dll);
64 ShowMessage(FloatToStr((Windows.GetTickCount - sTime) / 1000) + '');
65
66 end;
67
68 end.
相关阅读 更多 +
排行榜 更多 +
马里奥赛车世界游戏手机版下载

马里奥赛车世界游戏手机版下载

赛车竞速 下载
无畏契约皮肤开箱器手游下载

无畏契约皮肤开箱器手游下载

休闲益智 下载
旭日之城官方正版下载

旭日之城官方正版下载

策略塔防 下载