這是傳送端的程式
Private Sub Command1_Click() '傳送圖片
Dim n
Dim i, s, u
Dim OFbyt() As Byte '讀入檔案的緩衝
Dim data() As Byte '檔案分解的緩衝
Command1.Enabled = False
Open Text2.Text For Binary As #1 ' 開啟檔案。
i = 1
s = LOF(i) / 2000
OFbyt = InputB(LOF(i), i)
For n = 0 To (LOF(i) / 2000) '將檔案以...byte分成一段一段
Label4.Caption = "傳送中"
u = n / s
Text1.Text = u * 100 & "%"
data = MidB(OFbyt, n * 2000 + 1, 2000)
WinSock1.SendData data
Do Until Text3.Text = "1"
DoEvents
Loop
Text3.Text = "0"
Next
Label4.Caption = "完成"
Text1.Text = "100%"
Command1.Enabled = True
ok = "傳送終了"
MsgBox (ok)
Close #1
End Sub
Private Sub Command1_Click() '傳送圖片
Dim n
Dim i, s, u
Dim OFbyt() As Byte '讀入檔案的緩衝
Dim data() As Byte '檔案分解的緩衝
Command1.Enabled = False
Open Text2.Text For Binary As #1 ' 開啟檔案。
i = 1
s = LOF(i) / 2000
OFbyt = InputB(LOF(i), i)
For n = 0 To (LOF(i) / 2000) '將檔案以...byte分成一段一段
Label4.Caption = "傳送中"
u = n / s
Text1.Text = u * 100 & "%"
data = MidB(OFbyt, n * 2000 + 1, 2000)
WinSock1.SendData data
Do Until Text3.Text = "1"
DoEvents
Loop
Text3.Text = "0"
Next
Label4.Caption = "完成"
Text1.Text = "100%"
Command1.Enabled = True
ok = "傳送終了"
MsgBox (ok)
Close #1
End Sub
文章標籤
全站熱搜

http://tlcheng.adsldns.org/TLCheng/Hermes/sendfile.htm