unit COSFormu; interface uses Windows, SysUtils, Classes, Dialogs, Forms, StdCtrls, Controls, ExtCtrls; type TForm1 = class(TForm) InitButton: TButton; StartButton: TButton; IRQEdit: TEdit; Label1: TLabel; CountLabel: TLabel; Bevel1: TBevel; StatusLabel: TLabel; DataLabel: TLabel; Label4: TLabel; BaseEdit: TEdit; GroupBox1: TGroupBox; BusTypeCombo: TComboBox; Label5: TLabel; Label6: TLabel; BusNumberEdit: TEdit; Bevel3: TBevel; ExitButton: TButton; AbortButton: TButton; procedure InitButtonClick(Sender: TObject); procedure StartButtonClick(Sender: TObject); procedure ExitButtonClick(Sender: TObject); procedure AbortButtonClick(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public IRQ : Byte; IRQ_Count : Word; end; var Form1: TForm1; x: Integer; DLLHandle : THANDLE; Success: Boolean; implementation uses COSThrdu, ACCES32, WIN32COS; var MyThread: COSThread; {$R *.DFM} procedure TForm1.StartButtonClick(Sender: TObject); begin MyThread := COSThread.Create(false); StartButton.Enabled := false; AbortButton.Enabled := true; end; procedure TForm1.InitButtonClick(Sender: TObject); var BN, IRQ: Byte; BusType: SmallInt; Base: DWORD; begin if BusTypeCombo.Text = 'ISA' then BusType := Isa else if BusTypeCombo.Text = 'PCI' then BusType := PCIBus else BusType := InterfaceTypeUndefined; try BN := StrToInt(BusNumberEdit.Text); except BN := 0; end; Base := StrToInt('$'+BaseEdit.Text); IRQ := StrToInt(IRQEdit.Text); Success := InitCOSDriver(Base, IRQ, BusType, BN); if not Success then StatusLabel.Caption := 'Driver Error During Initialization' else StatusLabel.Caption := 'Press Start Acquisition'; end; procedure TForm1.ExitButtonClick(Sender: TObject); begin Close; end; procedure TForm1.AbortButtonClick(Sender: TObject); begin MyThread.Terminate; AbortCOSRequest; StatusLabel.Caption := 'Aborted - press Start Acquisition to continue'; AbortButton.Enabled := false; StartButton.Enabled := true; end; procedure TForm1.FormCreate(Sender: TObject); begin if (InPortB($61) = $AA55) then begin Application.MessageBox('ACCESNT.SYS not detected. Please copy ACCESNT.SYS into [NT]/system32/drivers and re-run this sample.', 'Warning', IDOK); end; end; end.