我在VB 6.0上模仿CH372DBG\DOWNFILE\WINDOWS下的Transfile函數(shù),一直都接不到數(shù)據(jù),頭痛??! 請(qǐng)指點(diǎn)一二?。? Private Function TransFile(ByVal hWnd As Long) As Boolean
Dim ReadLen As Long Dim mLen As Long mLen = 0 Dim by As Byte Dim bylen As Long by = 0 bylen = 0 Trb = 0 Dim Writebuff As mBuff mTotal = 1 Writebuff.mBuff(0) = 0
Dim sb As OVERLAPPED With sb .Internal = 0 .InternalHigh = 0 .offset = 0 .OffsetHigh = 0 .hEvent = 0 End With 'Dim addr As Long Call CH375Writedata(0, mBuffer, mTotal) Do While (1) ReadLen = 1024 Call ReadFile(hWnd, mBuffer, 1024, ReadLen, sb)
If (ReadLen < 1024) Then mLen = ReadLen On Error Resume Next If (CH375Writedata(0, mBuffer, mLen)) Then If (mLen <> 0) Then Trb = Trb + 1 End If MsgBox "寫結(jié)束 " & Trb & "K" Exit Do Else MsgBox "寫數(shù)據(jù)失敗" Exit Do End If Else mLen = ReadLen On Error Resume Next If (CH375Writedata(0, mBuffer, mLen)) Then If (mLen <> 0) Then Trb = Trb + 1 End If MsgBox "寫結(jié)束 " & Trb & "K" Else MsgBox "寫數(shù)據(jù)失敗" ' Exit Do End If End If TransFile = False
'Else Loop 'Loop
End Function