'---Открытие файла
Public Function OpenFile(Path As Variant)
On Error Resume Next
If fNum = 0 Then
fNum = FreeFile
Open Path For Binary Access Read As #fNum
End If
OpenFile = Err.Number
End Function
'----Закрытие файла
Public Function CloseFile()
On Error Resume Next
Close #fNum
fNum = 0
CloseFile = Err.Number
End Function
'----Чтение из файла побайтно.
Public Function ReadFile(Bytes As Variant) As Variant
'Если перевалили за границу чтения, то
If Bytes > LOF(fNum) - Loc(fNum) Then Bytes = LOF(fNum) - Loc(fNum)
ReadFile = InputB(Bytes, #fNum)
End Function
Private Sub Form_Activate()
Set STREAM = CreateObject("Binary.STREAM")
STREAM.OpenFile ("C:\mu.wmv")
Do
Bytes = STREAM.ReadFile(10000)
Text1 = Text1 & Bytes
DoEvents
Loop Until Bytes = ""
STREAM.CloseFile
Set STREAM = Nothing
End Sub
ALX_2002 писал(а):2 all: Ну неужели никак ускорить нельзя ?
ReadFile = InputB(nBytes, #fNum)
LOF() - Loc() < nBytes
If Bytes > LOF(fNum) - Loc(fNum) Then Bytes = LOF(fNum) - Loc(fNum)
LOF() - Loc() < nBytes
ALX_2002 писал(а):Разве не равноценно ?
Open Path For Binary Access Read As #fNum
Open Path For Input As #fNum
Сейчас этот форум просматривают: Google-бот, Yandex-бот и гости: 33