Passage de paramètres d'un thread au thread principal
Bonjour,
Est-il possible qu'un thread (crée par l'évenement d'un composant placé sur la fiche principale) repasse des paramètres à la fiche depuis laquelle il a été créé.
Si oui quel chemin emprunter et comment le mettre en oeuvre.
D'avance merci pour votre aide.
Chris.
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9
|
procedure TForm1.PhoneX1RouteRequestService(Sender: TObject;
const clsCall: ICallClass);
var
RoutingThread: TRoutingThread;
begin
clscall.NewDN:=VDNout.Text;
RoutingThread:=TRoutingThread.Create(PhoneX1);
end; |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
unit Thread;
interface
uses
Classes, dialogs, windows, PHONEXLib_TLB, main;
type
TRoutingThread = class(TThread)
private
PhoneX1C: TPhoneX;
protected
procedure Execute; override;
public
constructor Create(APhoneX1: TPhonex);
end;
implementation
constructor TRoutingThread.Create(APhoneX1: TphoneX);
begin
FreeOnTerminate := True;
inherited Create(False);
PhoneX1C:=APhoneX1;
end;
procedure TRoutingThread.Execute;
var
clsCall:ICallClass;
i:integer;
begin
for i:=1 to Phonex1C.ActiveCallClasses.Count do
clsCall:=Phonex1C.ActiveCallClasses.Item(i);
clsCall.UUI:='3';
if clsCall.CallerDigits='1234567890' then clsCall.UUI:='1';
if clsCall.CallerDigits='0987654321' then clsCall.UUI:='2';
PhoneX1C.RouteSelect(clscall);
end;
end. |