Здравствуйте, AkaProc!
Вообще говоря, Вам ассемблер и не нужен...
Можно вызывать API-шные функции, этого вполне достаточно.
Смотрите небольшой пример в приложении
Если все же хочется "прикрутить" ассемблер, то вот Вам
ссылочка. Там есть интересный проект, который поможет Вам разобраться
Приложение:
Поект ReadFile.vbp----------------------------
Type=Exe
Form=Form3.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\WINDOWS\system32\stdole2.tlb#OLE Automation
Class=cReadFile; cReadFile.cls
IconForm="Form1"
Startup="Form1"
Command32=""
Name="Project1"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="kbvideo"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
[MS Transaction Server]
AutoRefresh=1
Форма form3.frm -------------------------------
VERSION 5.00
Begin VB.Form Form1
Caption = "Read file example"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton ReadFile
Caption = "Read file"
Height = 735
Left = 1320
Style = 1 'Graphical
TabIndex = 0
Top = 480
Width = 1815
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim F As New cReadFile
Private Sub ReadFile_Click()
Dim b As Byte, i As Long, lenght As Long
F.OpenFile (void)
lenght = F.FileSize()
For i = 0 To lenght
b = F.ReadByte() 'b - очередной байт
Next i
F.CloseFile (void)
End Sub
Класс cReadFile.cls-------------------------------------------
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "cReadFile"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, _
ByVal Access As Long, ByVal Share As Long, ByVal Security As Long, ByVal Disp As Long, _
ByVal Attr As Long, ByVal Template As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hFile As Long) As Long
Private Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long, ByVal lpBuffer As Long, _
ByVal Count As Long, ByVal Readed As Long, ByVal Overlapped As Long) As Long
Private Declare Function GetFileSize Lib "kernel32" (ByVal hFile As Long, ByVal high As Long) As Long
Private m_hFile As Long
Private Const GMEM_FIXED As Long = &H0
Private Const GENERIC_READ As Long = &H80000000
Private Const OPEN_EXISTING As Long = &H3
Private Const FILE_ATTRIBUTE_NORMAL As Long = &H80
Private Sub Class_Initialize()
m_hFile = 0
End Sub
Private Sub Class_Terminate()
If m_hFile Then CloseHandle (m_hFile)
End Sub
Public Sub OpenFile(void)
m_hFile = CreateFile("test.txt", GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)
If m_hFile = -1 Then
MsgBox "File 'test.txt' not found", , "Error"
m_hFile = 0
End If
End Sub
Public Function ReadByte()
Dim Buf As Byte, Readed As Long, Res As Boolean, i As Long
If m_hFile Then
Res = ReadFile(m_hFile, VarPtr(Buf), 1, VarPtr(Readed), 0)
If Res And Readed = 1 Then
ReadByte = Buf
Else
ReadByte = 0
End If
Else
ReadByte = 0
End If
End Function
Public Sub CloseFile(void)
If m_hFile Then
CloseHandle (m_hFile)
m_hFile = 0
End If
End Sub
Public Function FileSize()
Dim high As Long
If m_hFile Then
FileSize = GetFileSize(m_hFile, VarPtr(high))
Else
FileSize = 0
End If
End Function