转自:.html
unit1
unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls;type
Test=recorda: Integer;b: Integer;end;TForm1 = class(TForm)btn1: TButton;memo1: TMemo;procedure btn1Click(Sender: TObject);private{ Private declarations }public{ Public declarations }end;varForm1: TForm1;function MyThreadFun(var Param: Test): Integer; stdcall; //注,此行写成TForm1.MyThreadFun Createthread调用处会报错。
implementationuses Unit2;{$R *.dfm}function MyThreadFun(var Param: Test): Integer; stdcall;
beginForm1.Memo1.Text := IntToStr(Param.a);Result := 0;
end;procedure TForm1.btn1Click(Sender: TObject);
varId: Dword;P: test;
beginp.a:=5;Createthread(nil, 0, @MyThreadFun, @p, 0, Id);
end;
本文发布于:2024-01-31 20:12:48,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170670316931076.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |