CreateThread多参数传递
Student = record
Name: PChar;
age: integer;
end;
pStudent=^Student;
var
h: THandle;
procedure aa(cc: pStudent); stdcall;
begin
Form1.Memo1.Lines.Add(cc.Name);
Form1.Memo1.Lines.Add(IntToStr(cc.age));
Dispose(cc); //记得释放内存
ExitThread(0);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
id: Cardinal;
p: pStudent;
begin
New(p);
try
p.Name := PChar(form1.edt1.text);
p.age := 100;
h := CreateThread(nil, 0, @aa, p, 0, id);
finally
if h <> 0 then CloseHandle(h);
end;
end;
————————————————
原文链接:https://blog.csdn.net/haiou327/article/details/8610937
Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号
执行时间: 0.095072984695435 seconds