求教一个压缩图片的方法
客户端Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim a As String, x As Byte
Winsock1.GetData a, vbString
If Val(a) = 1 Then
Call keybd_event(vbKeySnapshot, 0, 0, 0)
ElseIf Val(a) = 2 Then
SavePicture Clipboard.GetData(), "e:\1.bmp"
Winsock1.SendData "st"
ElseIf Val(a) = 3 Then
Open "e:\1.bmp" For Binary As #1
Do While Not EOF(1)
Get #1, , x
Winsock1.SendData x
Loop
Close #1
Winsock1.SendData "en"
End If
End Sub
服务端
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim buf() As Byte
ReDim buf(bytesTotal) As Byte
Winsock1.GetData buf
If bytesTotal = 2 And Chr(buf(0)) = "s" And Chr(buf(1)) = "t" Then
Open "d:\1.bmp" For Binary As #1
Winsock1.SendData "3"
ElseIf bytesTotal = 2 And Chr(buf(0)) = "e" And Chr(buf(1)) = "n" Then
Close #1
Command2.Enabled = True
Else
Put #1, , buf
End If
End Sub
传输时生成的图片有2M希望有高手能指教一下要怎么压缩图片
或是有其他方法能做到动态显示对方桌面