'工程1
Private Sub Timer1_Timer() '发送Picture1中的图片
Dim BB() As Byte
'图片Picture1读入BB
Dim PBag As New PropertyBag
PBag.WriteProperty "Picture", Picture1.Picture
BB = PBag.Contents
'Winsock1.SendData PBag.Contents
Set PBag = Nothing
Winsock1.SendData BB '发送整个二进制
DoEvents
End Sub
'工程2 这个工程要怎么写才能正常发到图片
Private Sub Winsock1_DataArrival(Index As Integer, ByVal bytesTotal As Long) '来信
Dim Bf As Byte
Winsock1(List1.Text).GetData Bf, vbByte + vbArray ' 接收Winsock1(List1.Text)发来的图片
If UBound(BB) >= "这里应是什么?" Then '因为Winsock1一次只能收到8000多字节,这里是个大问题
Dim PBag As New PropertyBag
PBag.WriteProperty "Picture", Picture1.Picture
PBag.Contents = Bf
Picture1.Picture = PBag.ReadProperty("Picture")
Set PBag = Nothing
End If
End Sub
接收时不要写入硬盘,这样我也会,我想要的是用代码就完成,不要写入硬盘临时文件