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
| // -----------------------------------------------------------
// Classe dérivée de TThread avec une propriété de +
// -----------------------------------------------------------
class TThreadSpeciale : public TThread
{
public:
Config *VilleConfig;
__fastcall TThreadSpeciale (bool CreateSuspended, Config *config) : TThread(CreateSuspended)
{
VilleConfig = config;
}
};
// -----------------------------------------------------------
// Différentes classes dérivées de TThread1
// -----------------------------------------------------------
class TThread1 : public TThreadSpeciale
{
protected:
virtual void __fastcall Execute()
{
Fonction1(...);
}
public:
__fastcall TThread1(bool CreateSuspended, Config *config) : TThreadSpeciale(CreateSuspended, config) {}
};
// -----------------------------------------------------------
class TThread2 : public TThreadSpeciale
{
protected:
virtual void __fastcall Execute()
{
Fonction2(...);
}
public:
__fastcall TThread2(bool CreateSuspended, Config *config) : TThreadSpeciale(CreateSuspended, config) {}
};
// -----------------------------------------------------------
class TThread3 : public TThreadSpeciale
{
protected:
virtual void __fastcall Execute()
{
Fonction3(...);
}
public:
__fastcall TThread3(bool CreateSuspended, Config *config) : TThreadSpeciale(CreateSuspended, config) {}
};
// -----------------------------------------------------------
// Classe TTimerPlanning
// -----------------------------------------------------------
class TTimerPlanning : public TTimer
{
public:
TLabel *Label; // Label qui affichera le temps restant
String TexteLabel; // Texte qui sera affiché sur le label. Par exemple, TexteLabel = "Prochain téléchargement dans "
TThreadSpeciale *Thread; // Thread qui sera lancé "OnTimer"
vector<unsigned short> PlanningHeure;
vector<unsigned short> PlanningMinute;
__fastcall TTimerPlanning(TComponent *AOwner, vector<unsigned short> planning_heure, vector<unsigned short> planning_minute, TThreadSpeciale *thread);
__fastcall TTimerPlanning(TComponent *AOwner, vector<unsigned short> planning_heure, vector<unsigned short> planning_minute, TThreadSpeciale *thread, TLabel *label, String texte_label);
}; |
Partager