dfm}
procedure TForm1. FormCreate (Sender: TObject);
var
msg: AnsiString;
begin
Lpt: = TLptPortConnection. Create;
if not Lpt. Ready then
begin
msg: = 'Помилка при створенні обєкта Lpt, драйвер ERROR, код = '+ Application. MessageBox (PChar (msg), 'ERROR', MB_OK);
Application. Terminate;
end;
ComboBox1. Items. Clear;
if Lpt. IsPortPresent (LPT1) then
ComboBox1. Items. Add ('$ 3BC');
if Lpt. IsPortPresent (LPT2) then
ComboBox1. Items. Add ('$ 378');
if Lpt. IsPortPresent (LPT3) then
ComboBox1. Items. Add ('$ 278');
if 0 = ComboBox1. Items. Count then
begin
ComboBox1. Items. Add ('LPT ïîðò Ві Гў ГГҐ Г§Гà éäåГГ® ');
ComboBox1. ItemIndex: = 0;
end
else
ComboBox1. ItemIndex: = 0;
Lpt. WritePort (GetCurrentPort, 0,0);
Lpt. WritePort (GetCurrentPort, 2,3);
end;
procedure TForm1. FormDestroy (Sender: TObject);
begin
Lpt. Destroy;
Timer1. Enabled: = false;
end;
function TForm1. GetCurrentPort: byte;
begin
if '$ 3BC' = ComboBox1. Text then
GetCurrentPort: = LPT1
else
if '$ 378' = ComboBox1. Text then
GetCurrentPort: = LPT2
else
GetCurrentPort: = LPT3;
end;
procedure TForm1. Timer1Timer (Sender: TObject);
begin
CheckBox1. Checked: = Pin1;
CheckBox2. Checked: = Pin2;
CheckBox3. Checked: = Pin3;
CheckBox4. Checked: = Pin4;
CheckBox5. Checked: = Pin5;
CheckBox6. Checked: = Pin6;
CheckBox7. Checked: = Pin7;
CheckBox8. Checked: = Pin8;
CheckBox9. Checked: = Pin9;
CheckBox10. Checked: = Pin10;
CheckBox11. Checked: = Pin11;
CheckBox12. Checked: = Pin12;
CheckBox13. Checked: = Pin13;
CheckBox14. Checked: = Pin14;
CheckBox15. Checked: = Pin15;
CheckBox16. Checked: = Pin16;
CheckBox17. Checked: = Pin17;
if Pin1 = true then
Shape1. Brush. Color: = clRed
else
Shape1. Brush. Color: = clWhite;
if Pin2 = true then
Shape2. Brush. Color: = clRed
else
Shape2. Brush. Color: = clWhite;
if Pin3 = true then
Shape3. Brush. Color: = clRed
else
Shape3. Brush. Color: = clWhite;
if Pin4 = true then
Shape4. Brush. Color: = clRed
else
Shape4. Brush. Color: = clWhite;
if Pin5 = true then
Shape5. Brush. Color: = clRed
else
Shape5. Brush. Color: = clWhite;
if Pin6 = true then
Shape6. Brush. Color: = clRed
else
Shape6. Brush. Color: = clWhite;
if Pin7 = true then
Shape7. Brush. Color: = clRed
else
Shape7. Brush. Color: = clWhite;
if Pin8 = true then
Shape8. Brush. Color: = clRed
else
Shape8. Brush. Color: = clWhite;
if Pin9 = true then
Shape9. Brush. Color: = clRed
else
Shape9. Brush. Color: = clWhite;
if Pin10 = true then
Shape10. Brush. Color: = clRed
else
Shape10. Brush. Color: = clWhite;
if Pin11 = true then
Shape11. Brush. Color: = clRed
else
Shape11. Brush. Color: = clWhite;
if Pin12 = true then
Shape12. Brush. Color: = clRed
else
Shape12. Brush. Color: = clWhite;
if Pin13 = true then
Shape13. Brush. Color: = clRed
else
Shape13. Brush. Color: = clWhite;
if Pin14 = true then
Shape14. Brush. Color: = clRed
else
Shape14. Brush. Color: = clWhite;
if Pin15 = true then
Shape15. Brush. Color: = clRed
else
Shape15. Brush. Color: = clWhite;
if Pin16 = true then
Shape16. Brush. Color: = clRed
else
Shape16. Brush. Color: = clWhite;
if Pin17 = true then
Shape17. Brush. Color: = clRed
else
Shape17. Brush. Color: = clWhite;
end;
procedure TForm1. Button1Click (Sender: TObject);
begin
ButtonPin1;
end;
procedure TForm1. Button2Click (Sender: TObject);
begin
ButtonPin2;
end;
procedure TForm1. Button3Click (Sender: TObject);
begin
ButtonPin3;
end;
procedure TForm1. Button4Click (Sender: TObject);
begin
ButtonPin4;
end;
procedure TForm1. Button5Click (Sender: TObject);
...