📄 dlportiox.~h
字号:
//---------------------------------------------------------------------------
#ifndef DLPortIOXH
#define DLPortIOXH
//---------------------------------------------------------------------------
#include <SysUtils.hpp>
#include <Classes.hpp>
#include <Controls.hpp>
#include "LdriverX.h"
//---------------------------------------------------------------------------
class PACKAGE TDLPortIOX : public TCustomControl
{
private:
TLdriverX mDriver;
Graphics::TBitmap *BpH;
AnsiString __fastcall GetDllPAth(){return mDriver.FDLLPath;};
short __fastcall GetPortWord(int Address){ return mDriver.DlReadWord(Address); }
void __fastcall SetPortWord(int Address, short Data){ mDriver.DlWriteWord(Address, Data); }
protected:
virtual void __fastcall Paint();
__property short Port[int Address]={read=ReadPort,write=WritePort};
UCHAR __fastcall GetLPTNumPorts() { return mDriver.FLPTCount; }
public:
__fastcall TDLPortIOX(TComponent* Owner);
__fastcall ~TDLPortIOX(){};
void __fastcall OpenDriver(){mDriver.OpenDriver();};
void __fastcall CloseDriver(){mDriver.CloseDriver();};
// Allows write/read array of ports.
void __fastcall PortControl(TPortRec Ports[], WORD NumPorts);
void __fastcall PortCommand(TPortCommand Ports[], WORD NumPorts);
// Allows read/write array of bytes from single port.
void __fastcall ReadPortFIFO(int PortAddr, int NumPorts, int Buffer[])
{ mDriver.DlReadBufferWord(PortAddr, Buffer, NumPorts); }
void __fastcall WritePortFIFO(int PortAddr, int NumPorts, int Buffer[])
{ mDriver.DlWriteBufferWord(PortAddr, Buffer, NumPorts); }
// Access any port as you like
short __fastcall ReadPort(int Address)
{ return mDriver.DlReadWord(Address); }
void __fastcall WritePort(int Address, short Data)
{ mDriver.DlWriteWord(Address, Data); }
int __fastcall GetLPTBasePort(char PortNr);
__published:
// Sets the path (no ending \, nor any filename) of the DLPortIO.SYS file
// Assumed to be <windows system directory>\DRIVERS if not specified
// Has no effect if the DriverLINX driver is already installed
__property AnsiString DriverPath={read=mDriver.FDriverPath,write=mDriver.FDriverPath};
// Sets the path (no ending \, nor any filename) of the DLPortIO.DLL file
// Assumed to be "" if not specified, meaning it will search the program
// path, windows directory and computer's path for the DLL
__property AnsiString DLLPath={read=mDriver.FDLLPath,write=mDriver.FDLLPath};
// True when the DLL/Driver has been loaded successfully after OpenDriver()
__property bool ActiveHW={read=mDriver.FActiveHW};
// This doesn't really do anything; provided for compatibility only
__property bool HardAccess={read=mDriver.FHardAccess,write=mDriver.FHardAccess,default=true};
// Returns the last error which occurred in Open/CloseDriver()
__property AnsiString LastError={read=mDriver.FLastError};
__property UCHAR LPTNumPorts={read=GetLPTNumPorts};
};
//---------------------------------------------------------------------------
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -