⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iomodemport.bas

📁 功能强大的API
💻 BAS
📖 第 1 页 / 共 2 页
字号:
Public Const CE_BREAK = &H10                '  Break Detected
Public Const CE_TXFULL = &H100              '  TX Queue is full
Public Const CE_PTO = &H200                 '  LPTx Timeout
Public Const CE_IOE = &H400                 '  LPTx I/O Error
Public Const CE_DNS = &H800                 '  LPTx Device not selected
Public Const CE_OOP = &H1000                '  LPTx Out-Of-Paper
Public Const CE_MODE = &H8000               '  Requested mode unsupported

Public Const IE_BADID = (-1)                '  Invalid or unsupported id
Public Const IE_OPEN = (-2)                 '  Device Already Open
Public Const IE_NOPEN = (-3)                '  Device Not Open
Public Const IE_MEMORY = (-4)               '  Unable to allocate queues
Public Const IE_DEFAULT = (-5)              '  Error in default parameters
Public Const IE_HARDWARE = (-10)            '  Hardware Not Present
Public Const IE_BYTESIZE = (-11)            '  Illegal Byte Size
Public Const IE_BAUDRATE = (-12)            '  Unsupported BaudRate

' Events
Public Const EV_RXCHAR = &H1                '  Any Character received
Public Const EV_RXFLAG = &H2                '  Received certain character
Public Const EV_TXEMPTY = &H4               '  Transmitt Queue Empty
Public Const EV_CTS = &H8                   '  CTS changed state
Public Const EV_DSR = &H10                  '  DSR changed state
Public Const EV_RLSD = &H20                 '  RLSD changed state
Public Const EV_BREAK = &H40                '  BREAK received
Public Const EV_ERR = &H80                  '  Line status error occurred
Public Const EV_RING = &H100                '  Ring signal detected
Public Const EV_PERR = &H200                '  Printer error occured
Public Const EV_RX80FULL = &H400            '  Receive buffer is 80 percent full
Public Const EV_EVENT1 = &H800              '  Provider specific event 1
Public Const EV_EVENT2 = &H1000             '  Provider specific event 2

' Escape Functions
Public Const SETXOFF = 1  '  Simulate XOFF received
Public Const SETXON = 2 '  Simulate XON received
Public Const SETRTS = 3 '  Set RTS high
Public Const CLRRTS = 4 '  Set RTS low
Public Const SETDTR = 5 '  Set DTR high
Public Const CLRDTR = 6 '  Set DTR low
Public Const RESETDEV = 7       '  Reset device if possible
Public Const SETBREAK = 8  'Set the device break line
Public Const CLRBREAK = 9 ' Clear the device break line

'  PURGE function flags.
Public Const PURGE_TXABORT = &H1     '  Kill the pending/current writes to the comm port.
Public Const PURGE_RXABORT = &H2     '  Kill the pending/current reads to the comm port.
Public Const PURGE_TXCLEAR = &H4     '  Kill the transmit queue if there.
Public Const PURGE_RXCLEAR = &H8     '  Kill the typeahead buffer if there.

Public Const LPTx = &H80        '  Set if ID is for LPT device

'  Modem Status Flags
Public Const MS_CTS_ON = &H10&
Public Const MS_DSR_ON = &H20&
Public Const MS_RING_ON = &H40&
Public Const MS_RLSD_ON = &H80&


' COMM declarations
Declare Function SetCommState Lib "kernel32" (ByVal hCommDev As Long, lpDCB As DCB) As Long
Declare Function SetCommTimeouts Lib "kernel32" (ByVal hFile As Long, lpCommTimeouts As COMMTIMEOUTS) As Long
Declare Function GetCommState Lib "kernel32" (ByVal nCid As Long, lpDCB As DCB) As Long
Declare Function GetCommTimeouts Lib "kernel32" (ByVal hFile As Long, lpCommTimeouts As COMMTIMEOUTS) As Long
Declare Function PurgeComm Lib "kernel32" (ByVal hFile As Long, ByVal dwFlags As Long) As Long
Declare Function BuildCommDCB Lib "kernel32" Alias "BuildCommDCBA" (ByVal lpDef As String, lpDCB As DCB) As Long
Declare Function BuildCommDCBAndTimeouts Lib "kernel32" Alias "BuildCommDCBAndTimeoutsA" (ByVal lpDef As String, lpDCB As DCB, lpCommTimeouts As COMMTIMEOUTS) As Long
Declare Function TransmitCommChar Lib "kernel32" (ByVal nCid As Long, ByVal cChar As Byte) As Long
Declare Function SetCommBreak Lib "kernel32" (ByVal nCid As Long) As Long
Declare Function SetCommMask Lib "kernel32" (ByVal hFile As Long, ByVal dwEvtMask As Long) As Long
Declare Function ClearCommBreak Lib "kernel32" (ByVal nCid As Long) As Long
Declare Function ClearCommError Lib "kernel32" (ByVal hFile As Long, lpErrors As Long, lpStat As COMSTAT) As Long
Declare Function SetupComm Lib "kernel32" (ByVal hFile As Long, ByVal dwInQueue As Long, ByVal dwOutQueue As Long) As Long
Declare Function EscapeCommFunction Lib "kernel32" (ByVal nCid As Long, ByVal nFunc As Long) As Long
Declare Function GetCommMask Lib "kernel32" (ByVal hFile As Long, lpEvtMask As Long) As Long
Declare Function GetCommProperties Lib "kernel32" (ByVal hFile As Long, lpCommProp As COMMPROP) As Long
Declare Function GetCommModemStatus Lib "kernel32" (ByVal hFile As Long, lpModemStat As Long) As Long


'   A dynamic link library (DLL) initialization routine failed.
Public Const ERROR_DLL_INIT_FAILED = 1114&

'   A system shutdown is in progress.
Public Const ERROR_SHUTDOWN_IN_PROGRESS = 1115&

'   Unable to abort the system shutdown because no shutdown was in progress.
Public Const ERROR_NO_SHUTDOWN_IN_PROGRESS = 1116&

'   The request could not be performed because of an I/O device error.
Public Const ERROR_IO_DEVICE = 1117&

'   No serial device was successfully initialized.  The serial driver will unload.
Public Const ERROR_SERIAL_NO_DEVICE = 1118&

'   Unable to open a device that was sharing an interrupt request (IRQ)
'   with other devices. At least one other device that uses that IRQ
'   was already opened.
Public Const ERROR_IRQ_BUSY = 1119&

'   A serial I/O operation was completed by another write to the serial port.
'   (The IOCTL_SERIAL_XOFF_COUNTER reached zero.)
Public Const ERROR_MORE_WRITES = 1120&

'   A serial I/O operation completed because the time-out period expired.
'   (The IOCTL_SERIAL_XOFF_COUNTER did not reach zero.)
Public Const ERROR_COUNTER_TIMEOUT = 1121&

Type COMMCONFIG
    dwSize As Long
    wVersion As Integer
    wReserved As Integer
    dcbx As DCB
    dwProviderSubType As Long
    dwProviderOffset As Long
    dwProviderSize As Long
    wcProviderData As Byte
End Type

Declare Function CommConfigDialog Lib "kernel32" Alias "CommConfigDialogA" (ByVal lpszName As String, ByVal hWnd As Long, lpCC As COMMCONFIG) As Long
Declare Function CreateIoCompletionPort Lib "kernel32" (ByVal FileHandle As Long, ByVal ExistingCompletionPort As Long, ByVal CompletionKey As Long, ByVal NumberOfConcurrentThreads As Long) As Long
Declare Function GetCommConfig Lib "kernel32" (ByVal hCommDev As Long, lpCC As COMMCONFIG, lpdwSize As Long) As Long
Declare Function GetCompressedFileSize Lib "kernel32" Alias "GetCompressedFileSizeA" (ByVal lpFileName As String, lpFileSizeHigh As Long) As Long
Declare Function GetDefaultCommConfig Lib "kernel32" Alias "GetDefaultCommConfigA" (ByVal lpszName As String, lpCC As COMMCONFIG, lpdwSize As Long) As Long
Declare Function GetHandleInformation Lib "kernel32" (ByVal hObject As Long, lpdwFlags As Long) As Long
Declare Function GetProcessHeaps Lib "kernel32" (ByVal NumberOfHeaps As Long, ProcessHeaps As Long) As Long
Declare Function GetProcessWorkingSetSize Lib "kernel32" (ByVal hProcess As Long, lpMinimumWorkingSetSize As Long, lpMaximumWorkingSetSize As Long) As Long
Declare Function GetQueuedCompletionStatus Lib "kernel32" (ByVal CompletionPort As Long, lpNumberOfBytesTransferred As Long, lpCompletionKey As Long, lpOverlapped As Long, ByVal dwMilliseconds As Long) As Long
Declare Function SetCommConfig Lib "kernel32" (ByVal hCommDev As Long, lpCC As COMMCONFIG, ByVal dwSize As Long) As Long
Declare Function SetDefaultCommConfig Lib "kernel32" Alias "SetDefaultCommConfigA" (ByVal lpszName As String, lpCC As COMMCONFIG, ByVal dwSize As Long) As Long


Type PORT_INFO_2
    pPortName As String
    pMonitorName As String
    pDescription As String
    fPortType As Long
    Reserved As Long
End Type

Public Const PORT_TYPE_WRITE = &H1
Public Const PORT_TYPE_READ = &H2
Public Const PORT_TYPE_REDIRECTED = &H4
Public Const PORT_TYPE_NET_ATTACHED = &H8
Type MODEMDEVCAPS
    dwActualSize As Long
    dwRequiredSize As Long
    dwDevSpecificOffset As Long
    dwDevSpecificSize As Long

    '  product and version identification
    dwModemProviderVersion As Long
    dwModemManufacturerOffset As Long
    dwModemManufacturerSize As Long
    dwModemModelOffset As Long
    dwModemModelSize As Long
    dwModemVersionOffset As Long
    dwModemVersionSize As Long

    '  local option capabilities
    dwDialOptions As Long          '  bitmap of supported values
    dwCallSetupFailTimer As Long   '  maximum in seconds
    dwInactivityTimeout As Long    '  maximum in seconds
    dwSpeakerVolume As Long        '  bitmap of supported values
    dwSpeakerMode As Long          '  bitmap of supported values
    dwModemOptions As Long         '  bitmap of supported values
    dwMaxDTERate As Long           '  maximum value in bit/s
    dwMaxDCERate As Long           '  maximum value in bit/s

    '  Variable portion for proprietary expansion
    abVariablePortion(1) As Byte
End Type

Type MODEMSETTINGS
    dwActualSize As Long
    dwRequiredSize As Long
    dwDevSpecificOffset As Long
    dwDevSpecificSize As Long

    '  static local options (read/write)
    dwCallSetupFailTimer As Long       '  seconds
    dwInactivityTimeout As Long        '  seconds
    dwSpeakerVolume As Long            '  level
    dwSpeakerMode As Long              '  mode
    dwPreferredModemOptions As Long    '  bitmap
    
    '  negotiated options (read only) for current or last call
    dwNegotiatedModemOptions As Long   '  bitmap
    dwNegotiatedDCERate As Long        '  bit/s

    '  Variable portion for proprietary expansion
    abVariablePortion(1) As Byte
End Type

'  Dial Options
Public Const DIALOPTION_BILLING = &H40          '  Supports wait for bong "$"
Public Const DIALOPTION_QUIET = &H80            '  Supports wait for quiet "@"
Public Const DIALOPTION_DIALTONE = &H100        '  Supports wait for dial tone "W"

'  SpeakerVolume for MODEMDEVCAPS
Public Const MDMVOLFLAG_LOW = &H1
Public Const MDMVOLFLAG_MEDIUM = &H2
Public Const MDMVOLFLAG_HIGH = &H4

'  SpeakerVolume for MODEMSETTINGS
Public Const MDMVOL_LOW = &H0
Public Const MDMVOL_MEDIUM = &H1
Public Const MDMVOL_HIGH = &H2

'  SpeakerMode for MODEMDEVCAPS
Public Const MDMSPKRFLAG_OFF = &H1
Public Const MDMSPKRFLAG_DIAL = &H2
Public Const MDMSPKRFLAG_ON = &H4
Public Const MDMSPKRFLAG_CALLSETUP = &H8

'  SpeakerMode for MODEMSETTINGS
Public Const MDMSPKR_OFF = &H0
Public Const MDMSPKR_DIAL = &H1
Public Const MDMSPKR_ON = &H2
Public Const MDMSPKR_CALLSETUP = &H3
 
'  Modem Options
Public Const MDM_COMPRESSION = &H1
Public Const MDM_ERROR_CONTROL = &H2
Public Const MDM_FORCED_EC = &H4
Public Const MDM_CELLULAR = &H8
Public Const MDM_FLOWCONTROL_HARD = &H10
Public Const MDM_FLOWCONTROL_SOFT = &H20
Public Const MDM_CCITT_OVERRIDE = &H40
Public Const MDM_SPEED_ADJUST = &H80
Public Const MDM_TONE_DIAL = &H100
Public Const MDM_BLIND_DIAL = &H200
Public Const MDM_V23_OVERRIDE = &H400



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -