已经发送完毕,大家稍微等等再看邮箱。 to 楼主:我这确实用到了一个自带的dll,呵呵,你就不用给分了。 真正完完全全的源代码,恐怕1000$才会有人出,首先声明:我没有:)。
该自带的dll是windows本身的吗?
不是windows本身的,该dll不能采用regsvr32注册,直接放到system32或应用程序目录即可,当然要把那个声明模块加到工程中。to openforever(++) :谢谢你的热情,呵呵,不过我不缺分,只缺那个大家都知道的东东:)。 to boyzhang(张郎) :已发送 to yinweihong(yige) :我也是下半年找工作,呵呵。多积累经验,对找工作会有很大帮助的,我去年开发的一个系统被评为省优秀成果,正高兴中。
Option Strict OnImports System.Runtime.InteropServices Imports System.Text Imports System.Threading Public Class clsRs232 Private mhRS As Integer = -1 ' Handle to Com Port Private miPort As Integer = 1 ' Default is COM1 Private miTimeout As Integer = 10 ' Timeout in ms Private miBaudRate As Integer = 9600 Private meParity As DataParity = 0 Private meStopBit As DataStopBit = 0 Private miDataBit As Integer = 8 Private miBufferSize As Integer = 512 ' Buffers size default to 512 bytes Private mabtRxBuf As Byte() ' Receive buffer Private meMode As Mode ' Class working mode Private mbWaitOnRead As Boolean Private mbWaitOnWrite As Boolean Private mbWriteErr As Boolean Private muOverlapped As OVERLAPPED Private muOverlappedW As OVERLAPPED Private muOverlappedE As OVERLAPPED Private mabtTmpTxBuf As Byte() ' Temporary buffer used by Async Tx Private moThreadTx As Thread Private moThreadRx As Thread Private miTmpBytes2Read As Integer Private meMask As EventMasks#Region "Enums" ' This enumeration provides Data Parity values. Public Enum DataParity Parity_None = 0 Pariti_Odd Parity_Even Parity_Mark End Enum ' This enumeration provides Data Stop Bit values. ' It is set to begin with a one, so that the enumeration values ' match the actual values. Public Enum DataStopBit StopBit_1 = 1 StopBit_2 End Enum ' This enumeration contains values used to purge the various buffers. Private Enum PurgeBuffers RXAbort = &H2 RXClear = &H8 TxAbort = &H1 TxClear = &H4 End Enum ' This enumeration provides values for the lines sent to the Comm Port Private Enum Lines SetRts = 3 ClearRts = 4 SetDtr = 5 ClearDtr = 6 ResetDev = 7 ' Reset device if possible SetBreak = 8 ' Set the device break line. ClearBreak = 9 ' Clear the device break line. End Enum ' This enumeration provides values for the Modem Status, since ' we'll be communicating primarily with a modem. ' Note that the Flags() attribute is set to allow for a bitwise ' combination of values. <Flags()> Public Enum ModemStatusBits ClearToSendOn = &H10 DataSetReadyOn = &H20 RingIndicatorOn = &H40 CarrierDetect = &H80 End Enum ' This enumeration provides values for the Working mode Public Enum Mode NonOverlapped Overlapped End Enum ' This enumeration provides values for the Comm Masks used. ' Note that the Flags() attribute is set to allow for a bitwise ' combination of values. <Flags()> Public Enum EventMasks RxChar = &H1 RXFlag = &H2 TxBufferEmpty = &H4 ClearToSend = &H8 DataSetReady = &H10 ReceiveLine = &H20 Break = &H40 StatusError = &H80 Ring = &H100 End Enum #End Region
#Region "Structures" <StructLayout(LayoutKind.Sequential, Pack:=1)> Private Structure DCB Public DCBlength As Int32 Public BaudRate As Int32 Public Bits1 As Int32 Public wReserved As Int16 Public XonLim As Int16 Public XoffLim As Int16 Public ByteSize As Byte Public Parity As Byte Public StopBits As Byte Public XonChar As Char Public XoffChar As Char Public ErrorChar As Char Public EofChar As Char Public EvtChar As Char Public wReserved2 As Int16 End Structure <StructLayout(LayoutKind.Sequential, Pack:=1)> Private Structure COMMTIMEOUTS Public ReadIntervalTimeout As Int32 Public ReadTotalTimeoutMultiplier As Int32 Public ReadTotalTimeoutConstant As Int32 Public WriteTotalTimeoutMultiplier As Int32 Public WriteTotalTimeoutConstant As Int32 End Structure <StructLayout(LayoutKind.Sequential, Pack:=8)> Private Structure COMMCONFIG Public dwSize As Int32 Public wVersion As Int16 Public wReserved As Int16 Public dcbx As DCB Public dwProviderSubType As Int32 Public dwProviderOffset As Int32 Public dwProviderSize As Int32 Public wcProviderData As Int16 End Structure <StructLayout(LayoutKind.Sequential, Pack:=1)> Public Structure OVERLAPPED Public Internal As Int32 Public InternalHigh As Int32 Public Offset As Int32 Public OffsetHigh As Int32 Public hEvent As IntPtr End Structure <StructLayout(LayoutKind.Sequential, Pack:=1)> Private Structure COMSTAT Dim fBitFields As Int32 Dim cbInQue As Int32 Dim cbOutQue As Int32 End Structure#End Region
[email protected]多谢
[email protected],多大,太大就不要了
3q 3q kissoflife(明月高楼休独倚,酒入愁肠,化作相思泪!) to viena(晓琴) :不大的,不到200k
[email protected]
只是辛苦 kissoflife(明月高楼休独倚,酒入愁肠,化作相思泪!) 了
要发这么多,还不知道能不能拿到100份
真是不好意思了.全是 viena(晓琴)
回复人: viena(晓琴) ( ) 信誉:100 2004-05-12 13:46:00 得分:0
kissoflife(明月高楼休独倚,酒入愁肠,化作相思泪!) 发财了,发个Email就得1000分,呵呵
1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分1000分啊
[email protected]
谢谢!
to 楼主:我这确实用到了一个自带的dll,呵呵,你就不用给分了。
真正完完全全的源代码,恐怕1000$才会有人出,首先声明:我没有:)。
to boyzhang(张郎) :已发送
to yinweihong(yige) :我也是下半年找工作,呵呵。多积累经验,对找工作会有很大帮助的,我去年开发的一个系统被评为省优秀成果,正高兴中。
学习重要啊,
多谢kissoflife(明月高楼休独倚,酒入愁肠,化作相思泪!) 先。
[email protected]
[email protected]
kissoflife,你以前就帮助我回答过问题,非常感谢你对我们的帮助,你说的控件能给我发一个吗,再次感谢。
[email protected]
Imports System.Text
Imports System.Threading
Public Class clsRs232
Private mhRS As Integer = -1 ' Handle to Com Port
Private miPort As Integer = 1 ' Default is COM1
Private miTimeout As Integer = 10 ' Timeout in ms
Private miBaudRate As Integer = 9600
Private meParity As DataParity = 0
Private meStopBit As DataStopBit = 0
Private miDataBit As Integer = 8
Private miBufferSize As Integer = 512 ' Buffers size default to 512 bytes
Private mabtRxBuf As Byte() ' Receive buffer
Private meMode As Mode ' Class working mode
Private mbWaitOnRead As Boolean
Private mbWaitOnWrite As Boolean
Private mbWriteErr As Boolean
Private muOverlapped As OVERLAPPED
Private muOverlappedW As OVERLAPPED
Private muOverlappedE As OVERLAPPED
Private mabtTmpTxBuf As Byte() ' Temporary buffer used by Async Tx
Private moThreadTx As Thread
Private moThreadRx As Thread
Private miTmpBytes2Read As Integer
Private meMask As EventMasks#Region "Enums" ' This enumeration provides Data Parity values.
Public Enum DataParity
Parity_None = 0
Pariti_Odd
Parity_Even
Parity_Mark
End Enum ' This enumeration provides Data Stop Bit values.
' It is set to begin with a one, so that the enumeration values
' match the actual values.
Public Enum DataStopBit
StopBit_1 = 1
StopBit_2
End Enum ' This enumeration contains values used to purge the various buffers.
Private Enum PurgeBuffers
RXAbort = &H2
RXClear = &H8
TxAbort = &H1
TxClear = &H4
End Enum ' This enumeration provides values for the lines sent to the Comm Port
Private Enum Lines
SetRts = 3
ClearRts = 4
SetDtr = 5
ClearDtr = 6
ResetDev = 7 ' Reset device if possible
SetBreak = 8 ' Set the device break line.
ClearBreak = 9 ' Clear the device break line.
End Enum
' This enumeration provides values for the Modem Status, since
' we'll be communicating primarily with a modem.
' Note that the Flags() attribute is set to allow for a bitwise
' combination of values.
<Flags()> Public Enum ModemStatusBits
ClearToSendOn = &H10
DataSetReadyOn = &H20
RingIndicatorOn = &H40
CarrierDetect = &H80
End Enum ' This enumeration provides values for the Working mode
Public Enum Mode
NonOverlapped
Overlapped
End Enum ' This enumeration provides values for the Comm Masks used.
' Note that the Flags() attribute is set to allow for a bitwise
' combination of values.
<Flags()> Public Enum EventMasks
RxChar = &H1
RXFlag = &H2
TxBufferEmpty = &H4
ClearToSend = &H8
DataSetReady = &H10
ReceiveLine = &H20
Break = &H40
StatusError = &H80
Ring = &H100
End Enum
#End Region
<StructLayout(LayoutKind.Sequential, Pack:=1)> Private Structure DCB
Public DCBlength As Int32
Public BaudRate As Int32
Public Bits1 As Int32
Public wReserved As Int16
Public XonLim As Int16
Public XoffLim As Int16
Public ByteSize As Byte
Public Parity As Byte
Public StopBits As Byte
Public XonChar As Char
Public XoffChar As Char
Public ErrorChar As Char
Public EofChar As Char
Public EvtChar As Char
Public wReserved2 As Int16
End Structure
<StructLayout(LayoutKind.Sequential, Pack:=1)> Private Structure COMMTIMEOUTS
Public ReadIntervalTimeout As Int32
Public ReadTotalTimeoutMultiplier As Int32
Public ReadTotalTimeoutConstant As Int32
Public WriteTotalTimeoutMultiplier As Int32
Public WriteTotalTimeoutConstant As Int32
End Structure
<StructLayout(LayoutKind.Sequential, Pack:=8)> Private Structure COMMCONFIG
Public dwSize As Int32
Public wVersion As Int16
Public wReserved As Int16
Public dcbx As DCB
Public dwProviderSubType As Int32
Public dwProviderOffset As Int32
Public dwProviderSize As Int32
Public wcProviderData As Int16
End Structure
<StructLayout(LayoutKind.Sequential, Pack:=1)> Public Structure OVERLAPPED
Public Internal As Int32
Public InternalHigh As Int32
Public Offset As Int32
Public OffsetHigh As Int32
Public hEvent As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, Pack:=1)> Private Structure COMSTAT
Dim fBitFields As Int32
Dim cbInQue As Int32
Dim cbOutQue As Int32
End Structure#End Region
可以给我也发一份吗?
谢谢先~
[email protected]
[email protected]