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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| unit UnitThread_Selectionne;
interface
Uses classes, StdCtrls, SysUtils, windows, JvAnimatedImage, JvExControls,
JvComponent, JvGIFCtrl, JvExExtCtrls, JvImage, JvGIF, JvImageList;
Type
TThread_Selectionne = class(TThread)
private
FTLD : String;
protected
procedure Execute; override;
procedure Selectionne;
public
constructor Create;
property TLD : string read FTLD write FTLD;
//Pour pouvoir acceder à ta variable en dehors de l'unité end;
end;
Var
Thread_Selectionne : TThread_Selectionne;
implementation
Uses Unit1;
constructor TThread_Selectionne.Create;
begin
FreeOnTerminate := True;
inherited Create(False);
end;
Procedure TThread_Selectionne.Selectionne;
var
H: HModule;
F : Procedure(AString: PChar; ARetVal: PChar; ARetValMax: Integer);
Nom_Function : String;
begin
Nom_Function := ('Statut_' + TLD);
//On charge la dll adéquate
H := LoadLibrary('TLD_Europe.dll'); //GetModuleHandle(nil);
if H <> 0 then
begin
//On appel la Function adéquate pour obtenir le Statut; pex : Statut_Be
F := GetProcAddress(H, PChar(Nom_Function));
if Assigned(F) then
begin
//On écrit sur chaque Panel sélectionné le statut du nom de domaine
(F(PChar(''+Unit1.Form1.Edit_Domaine.Text+''), LResult, SizeOf(LResult)));
// Statut_MiseEnPage(TLabel(Unit1.Form1.FindComponent('Unit1.Form1.Label_Statut_' + TLD)), LResult);
//On cache le GifAnimator
TJvGifAnimator(Unit1.Form1.FindComponent('Unit1.Form1.GifAnimator_' + TLD)).Visible := False;
//On écrit sur chaque Panel sélectionné le nom du domaine recherché
//avec le TLD correspondant
TLabel(Unit1.Form1.FindComponent('Unit1.Form1.Label_Domaine_' + TLD)).Caption :=
LowerCase(Unit1.Form1.Edit_Domaine.Text) + '.' + LowerCase(TLD);
end;
end;
end;
Procedure TThread_Selectionne.Execute;
begin
FTLD := 'Be';
Synchronize(self, Selectionne);
end;
end. |
Partager