Multithreading problem ?!! Experts come to Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiAPI/html/delphi_20061110202423255.html
A function
Funtion temp (AA: integer; BB: integer): string;
VaR
I, J: integer;
Begin
For I = 0 to AA do
Begin
For J = 0 to BB do
Begin
String: = string + string;
End;
End;
Result: = string;
End;
Both buttons call this function, that is, the input parameters are different. The first button is Temp (), and the second button is Temp)
How can I use multiple threads to separate calls? The wine can be clicked consecutively without two buttons, and it does not need to be processed before it can continue to be clicked;
The returned variables are also available !!!!!
> How to separate multiple threads,
You inherit two thread classes from thread and call temp in execute of the class,
For more information, seeCodeAh
I met another unmotivated lazy person.
Tmythread = Class (tthread)
Private
Fa: integer;
FB: integer;
Function temp (AA: integer; BB: integer): string;
Protected
Procedure execute; override;
Public
Constructor create (const AA, AB: integer); reintroduce;
End;
Constructor tmythread. Create (const AA, AB: integer; AE: tedit );
Begin
Freeonterminate: = true;
Inherited create (true );
Fa: = AA;
FB: = AB;
End;
Procedure tmythread. Execute;
Begin
Inherited;
Temp (FA, FB );
End;
..........
Procedure tform1.button1click (Sender: tobject );
Begin
With tmythread. Create (100,100) Do
Resume;
End;
Procedure tform1.button1click (Sender: tobject );
Begin
With tmythread. Create (1000,100 0) Do
Resume;
End;
This is just a basic framework. As for the actual project and synchronization display, there is still a lot of work to do. Learn it by yourself!