//--------------------------------------------------------------------------- #include #pragma hdrstop #include #include "COSSAMPc.h" #include "ACCES32.h" #include "Win32COS.h" #include "COSThrd.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; COSThread *thrd; bool Success; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::ExitButtonClick(TObject *Sender) { Close(); } //--------------------------------------------------------------------------- void __fastcall TForm1::InitButtonClick(TObject *Sender) { unsigned char BN, IRQ; short BusType; unsigned long Base; if (BusTypeCombo->Text == "ISA") BusType = Isa; else if (BusTypeCombo->Text == "PCI") BusType = PCIBus; else BusType = InterfaceTypeUndefined; try { BN = StrToInt(BusNumberEdit->Text); } catch(EConvertError &error) { BN = 0; } sscanf(BaseEdit->Text.c_str(), "%lx", &Base); IRQ = StrToInt(IRQEdit->Text); Success = InitCOSDriver(Base, IRQ, BusType, BN); if (!Success) StatusLabel->Caption = "Driver Error During Initialization"; else StatusLabel->Caption = "Press Start Acquisition"; } //--------------------------------------------------------------------------- void __fastcall TForm1::StartButtonClick(TObject *Sender) { thrd = new COSThread(false); StartButton->Enabled = false; AbortButton->Enabled = true; } //--------------------------------------------------------------------------- void __fastcall TForm1::AbortButtonClick(TObject *Sender) { thrd->Terminate(); AbortCOSRequest(); StatusLabel->Caption = "Aborted - press Start Acquisition to resume"; AbortButton->Enabled = false; StartButton->Enabled = true; } //--------------------------------------------------------------------------- void __fastcall TForm1::FormCreate(TObject *Sender) { if (InPortB(0x61) == 0xAA55) { Application->MessageBox("ACCESNT.SYS not detected. Please copy ACCESNT.SYS into [NT]/system32/drivers and re-run this sample.", "Warning", IDOK); } } //---------------------------------------------------------------------------