# Re: 利用Mscomm控制项互传资料

Posted by 老怪 on September 27, 1998 at 17:08:30:

In Reply to: 利用Mscomm控制项互传资料 posted by chen on September 15, 1998 at 10:32:21:

: 如何利用Mscomm控制项经由RS232来传资料（将inputmode设成Binary），在甲电脑以位元组阵列传
: 则乙电脑端要如何将所传的资料秀出来麻烦请高手附个范例说明。
:

送二进位档案：
Dim FileHandle As Integer
Dim SendBuff() As Byte
FileHandle = FreeFile
Open "YourFilePathAndName" For Binary As #FileHandle
ReDim SendBuff(LOF(FileHandle) - 1)
Get #FileHandle, , SendBuff
Winsock1.SendData SendBuff
送二进位字串：
Dim SendBuff() As Byte
Dim SendString As String
SendString = "利用 WinSock.SendData 二进位方式送字串"
ReDim SendBuff(LenB(StrConv(SendString, vbFromUnicode)) - 1)
SendBuff = SendString
Winsock1.SendData SendBuff

Follow Ups: