当前位置:网站首页>Createanonymousthreadx passes parameters to anonymous threads
Createanonymousthreadx passes parameters to anonymous threads
2022-06-13 04:36:00 【zxm8513】

Pass parameters to the thread
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses TAnonymousThreadXUnit;
// The method to be executed
procedure MyMethod(count: Integer);
var
i: Integer;
begin
for i := 0 to count do
begin
Form1.Canvas.Lock;
Form1.Canvas.TextOut(10, 10, IntToStr(i));
Form1.Canvas.Unlock;
end;
end;
// The method to be executed 2
procedure MyMethod2(paramStr: string);
begin
ShowMessage(paramStr);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
paramStr: string;
begin
// demonstration 1: Parameters of the incoming
TThread.CreateAnonymousThreadX<Integer>(MyMethod, 5000).Start;
// demonstration 2:JSON Format parameters , This allows multiple parameters to be passed in at once
paramStr := '{"paramA":"1","paramB":"2"}';
TThread.CreateAnonymousThreadX<string>(MyMethod2, paramStr).Start;
end;
end.边栏推荐
- 2022道路运输企业安全生产管理人员操作证考试题库及答案
- Colab tutorial (super detailed version) and colab pro/pro+ evaluation
- Colab使用教程(超级详细版)及Colab Pro/Pro+评测
- A simple understanding of consistent hash
- PHP syntax
- Collection of wrong questions in soft test -- morning questions in the first half of 2011
- [flutter problem Series Chapter 67] the Solution to the problem of Routing cannot be jumped again in in dialog popup Using get plug - in in flutter
- Vercel 使用 HTTP 缓存
- 剑指 Offer 11. 旋转数组的最小数字-二分查找
- Applet waterfall flow
猜你喜欢

2022 ICML | Pocket2Mol: Efficient Molecular Sampling Based on 3D Protein Pockets

The data obtained from mongodb query data command is null

Colab tutorial (super detailed version) and colab pro/pro+ evaluation

剑指 Offer 56 - I. 数组中数字出现的次数

Day45. data analysis practice (1): supermarket operation data analysis

Ctfshow SQL injection (211-230)

如何只用4步,实现一个自定义JDBC驱动?

CTFSHOW SQL注入篇(211-230)

Interpretation and implementation of proxy mode

Ctfshow SQL injection (231-253)
随机推荐
推荐的图片临时在线压缩工具
Knife4j aggregation 2.0.9 supports automatic refresh of routing documents
Get verification code
Mongodb compass connects to the Alibaba cloud remote server database or reports an error occurred while loading instance info: command hostinfo req
2022 ICML | Pocket2Mol: Efficient Molecular Sampling Based on 3D Protein Pockets
Google Chrome browser reports an error: net:: err_ BLOCKED_ BY_ CLIENT
120. triangle minimum path sum - Dynamic Planning
A simple understanding of consistent hash
Suffix Automaton
Webpack system learning (VIII) how contenthash can prevent browsers from using cache files
ES6 learning
【Flutter 问题系列第 67 篇】在 Flutter 中使用 Get 插件在 Dialog 弹窗中不能二次跳转路由问题的解决方案
Latex operation
Interpretation and implementation of proxy mode
第007天:go语言字符串
PAT 1054 The Dominant Color
是“凯撒密码”呀。(*‘▽‘*)*
Solve the problem of running server nodemon reporting errors
2022 oxidation process operation certificate examination question bank and simulation examination
Implementation of homepage header function in PHP development blog system