求教,怎样让该段代码可以传输BMP图片
idhgd 2007-07-19 03:58:14 这是我看到的一个程序里的部分代码,用来传送文本文件没问题,可是传送别的就不行了,谁能给改改,谢谢
Public Sub SendFile(FileName As String, WinS As Winsock)
Dim FreeF As Integer
Dim LenFile As Long
Dim nCnt As Long
Dim LocData As String
Dim LoopTimes As Long
Dim i As Long
FreeF = FreeFile
Open FileName For Binary As #99
nCnt = 1
LenFile = LOF(99)
WinS.SendData "|FILESIZE|" & LenFile
DoEvents
Sleep (400)
Do Until nCnt >= (LenFile)
LocData = Space$(1024) 'Set size of chunks
Get #99, nCnt, LocData 'Get data from the file nCnt is from where to start the get
If nCnt + 1024 > LenFile Then
WinS.SendData Mid$(LocData, 1, (LenFile - nCnt))
Else
WinS.SendData LocData 'Send the chunk
End If
nCnt = nCnt + 1024
Loop
Close #99
End Sub