Form1->Lamp14->Brush->Color = clWhite;
Form1->Lamp15->Brush->Color = clWhite;
Form1->Lamp16->Brush->Color = clWhite;
Form1->Lamp24->Brush->Color = clWhite;
Form1->Lamp25->Brush->Color = clWhite;
Form1->Lamp26->Brush->Color = clWhite;
Form1->Lamp27->Brush->Color = clWhite;
Form1->Lamp28->Brush->Color = clWhite;
Form1->Lamp29->Brush->Color = clWhite;
Form1->Lamp30->Brush->Color = clWhite;
}
else
{
stop1 = false;
Button2->Caption = "Отключить";
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button5Click(TObject *Sender)
{
if(stop2 == false)
{
stop2 = true;
Button5->Caption = "Включить";
// "Отключаем 2-ю гирлянду"
Form1->Lamp4->Brush->Color = clWhite;
Form1->Lamp5->Brush->Color = clWhite;
Form1->Lamp6->Brush->Color = clWhite;
Form1->Lamp7->Brush->Color = clWhite;
Form1->Lamp8->Brush->Color = clWhite;
Form1->Lamp9->Brush->Color = clWhite;
Form1->Lamp17->Brush->Color = clWhite;
Form1->Lamp18->Brush->Color = clWhite;
Form1->Lamp19->Brush->Color = clWhite;
Form1->Lamp20->Brush->Color = clWhite;
Form1->Lamp21->Brush->Color = clWhite;
Form1->Lamp22->Brush->Color = clWhite;
Form1->Lamp23->Brush->Color = clWhite;
}
else
{
stop2 = false;
Button5->Caption = "Отключить";
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
hThread1 = CreateThread(NULL,0,Girlanda1ThreadFunc,NULL,0,NULL); //Создаём(стартуем 1-ый поток)
hThread2 = CreateThread(NULL,0,Girlanda2ThreadFunc,NULL,0,NULL); //Создаём(стартуем 2-ой поток)
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
TerminateThread(hThread1,0); //Завершаем 1-ый поток
TerminateThread(hThread2,0); //Завершаем 2-ой поток
}
//---------------------------------------------------------------------------
Листингфайла MainUnit.h
//---------------------------------------------------------------------------
#ifndef MainUnitH
#define MainUnitH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <jpeg.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TButton *Button1;
TGroupBox *GroupBox1;
TButton *Button2;
TGroupBox *GroupBox2;
TButton *Button5;
TImage *Image1;
TShape *Lamp1;
TShape *Lamp2;
TShape *Lamp3;
TShape *Lamp4;
TShape *Lamp5;
TShape *Lamp6;
TShape *Lamp7;
TShape *Lamp8;
TShape *Lamp10;
TShape *Lamp11;
TShape *Lamp12;
TShape *Lamp13;
TShape *Lamp14;
TShape *Lamp15;
TShape *Lamp16;
TShape *Lamp17;
TShape *Lamp18;
TShape *Lamp19;
TShape *Lamp20;
TShape *Lamp21;
TShape *Lamp22;
TShape *Lamp23;
TShape *Lamp9;
TShape *Lamp24;
TShape *Lamp25;
TShape *Lamp26;
TShape *Lamp27;
TShape *Lamp28;
TShape *Lamp29;
TShape *Lamp30;
TRadioGroup *RG1;
TRadioGroup *RG2;
void __fastcall Button1Click(TObject *Sender);
void __fastcall Button2Click(TObject *Sender);
void __fastcall Button5Click(TObject *Sender);
void __fastcall FormCreate(TObject *Sender);
void __fastcall FormDestroy(TObject *Sender);
private: // User declarations
public: // User declarations
static DWORD WINAPI Girlanda1ThreadFunc(LPVOID param);
static DWORD WINAPI Girlanda2ThreadFunc(LPVOID param);
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
Список литературы:
1. Программирование в C++ Builder. А.Я. Архангельский, Бином, Москва, 2003.- 1151 с.
2. Конспект лекций по курсу Операционные системы лектор Родников В.В. 2009г.
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.