var
point:Tpoint;
begin
getcursorpos(point);
//setcursorpos(100,300);//ranpoint
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
setcursorpos(point.x,point.y);
使用mouse_event来模拟鼠标按下的特征
//////////////////////////////////////////////////////////////////////
keybd_event(VK_CONTROL,mapvirtualkey(VK_CONTROL,0),0,0);{模拟按下control,}
keybd_event(65,mapvirtualkey(65,0),0,0); {模拟按下A}
keybd_event(65,mapvirtualkey(65,0),keyeventf_keyup,0);{模拟放开 A}
keybd_event(VK_CONTROL,mapvirtualkey(VK_CONTROL,0),keyeventf_keyup,0);{模拟放开Ctrl}
//////////////////////////////////////////////////////////////////////
hw:=FindWindow(nil,'Form');
GetWindowThreadProcessId(hw,@pid); //获取当前程序的进程号
h := OpenProcess(PROCESS_ALL_ACCESS, false, pid); //设定进程的访问权限
ReadProcessMemory(h,Pointer(adr), @val,sizeof(val), tt); //读取进程的内容
WriteProcessMemory(h,Pointer(adr), @val, sizeof(val), tt); //设置进程的内容
keybd_event(VK_DOWN,mapvirtualkey(VK_DOWN,0),0,0);
keybd_event(VK_DOWN,mapvirtualkey(VK_DOWN,0),keyeventf_keyup,0);
使用OnMouseDwon来判断鼠标的位置,并产生相应的命令
使用format的技巧
format('hello %d,%d',[x,y]);
可以使用Pagecontrol来创建WizardUI,这样我们就可以编写自己的wizard,我使用的是这样的工具
应该把自动辨识的也放到一个identify中
添加一个标识,来标识是否自动辨识,现在的情况是不,如果选择了是,那么要有一个timer进行跑事件,并判断当前的状态(),但不能和播放动画相冲突,
timer2.Time
begin
if facefound then
begin
icount:=icount+1;
if icount<maxtime then
exit;
if icount>maxtime then
begin
identify;
icount:=0;
end;
end;
//如果记数器不符合标准,退出
//如果找到脸,记数器符合标准,那么就进行辨识
end;
我们也可以把identify下面要执行的作一个死循环,即判断其中的值是否为可以进行下面的状态的东西,如果不是,则还要等待,如果其他地方的值有所改变了,则跳出循环,我们就可以进行了
while a=77 do
begin
application.ProcessMessages
end;
在delphi中写dll时为方便其他语言也可以调用dll中的函数,现在可以这样做在函数名后面加上stdcall,这样在使用vb调用时可以使用在一个模块中声明该函数,例如
option explicit
Declare Function youshow Lib "d:\bioidapi.dll" (ByVal ms As String) As Boolean
而在delphi中自己进行调用时
function youshow(ms:string):boolean;stdcall;external 'd:\bioidapi.dll';
一定要使用stdcall跟随相应的函数,否则调用会失败
读取指定目录下的所有文件
var
FileListBox1: TFileListBox;
myfile:Tstrings;
i:integer;
tmp:string;
begin
myfile:=Tstringlist.Create ;
FileListBox1 :=TFileListBox.Create(self);
FileListBox1.Parent :=self;
FileListBox1.Visible :=false;
filelistbox1.Directory :='d:\';
myfile:=filelistbox1.Items ;
listbox1.Clear;
for i := 0 to myfile.Count -1 do
begin
tmp:=rightstr(myfile.Strings[i],4);
if tmp='.bmp' then
listbox1.Items.Add('d:\'+myfile.Strings[i]);
end;
//myfile.Free;
// FileListBox1.Free;
end;
//把数据库中的图片存到文件中
var
cmdstr:string;
flist:Tstrings;
tmp:string;
pict:variant;
begin
flist:=Tstringlist.Create ;
cmdstr:='select * from T_picture';
with adoquery1 do
begin
sql.Clear;
sql.Add(cmdstr);
active:=true;
First;
end;
while not adoquery1.Eof do
begin
tmp:=adoquery1['name'];
tmp:='d:\'+tmp+'.bmp';
showmessage(tmp);
dbimage1.Picture.Assign(adoquery1.Fields[1]);
dbimage1.Picture.SaveToFile(tmp);
flist.Add(tmp);
adoquery1.next;
end;
listbox1.Items :=flist;
flist.Free;
使用指针进行变量的定义,操作等。这里以一个string为例进行说明!
var
p:^string;
begin
new(p); //为p开辟一段内存空间!
p^:='ddddd';
showmessage(p^);
end;
(出处:www.delphibbs.com)