Sería una cosa así: Call ExtractData(Param1, Param2, Param3)
Miren el módulo:
Código vb:
Ver original
Option Explicit Public NumBMP As Long 'Bitmap file format structures Type BITMAPFILEHEADER bfType As Integer bfSize As Long bfReserved1 As Integer bfReserved2 As Integer bfOffBits As Long End Type Type BITMAPINFOHEADER biSize As Long biWidth As Long biHeight As Long biPlanes As Integer biBitCount As Integer biCompression As Long biSizeImage As Long biXPelsPerMeter As Long biYPelsPerMeter As Long biClrUsed As Long biClrImportant As Long End Type Type RGBQUAD rgbBlue As Byte rgbGreen As Byte rgbRed As Byte rgbReserved As Byte End Type Type BITMAPINFO bmiHeader As BITMAPINFOHEADER bmiColors(0 To 255) As RGBQUAD End Type Public Type tGP File As Integer OffSet As Long Height As Long Width As Long FileSizeBMP As Long End Type Public GPdataBMP() As tGP Global gudtBMPFileHeader As BITMAPFILEHEADER 'Holds the file header Global gudtBMPInfo As BITMAPINFO 'Holds the bitmap info Global gudtBMPData() As Byte 'Holds the pixel data Sub ExtractData(strFileName As String, lngOffset As Long, FileSizeBMP As Long) Dim intBMPFile As Integer intBMPFile = FreeFile If FileSizeBMP = 0 Then Exit Sub Open strFileName For Binary Access Read Lock Write As intBMPFile ReDim gudtBMPData(FileSizeBMP - 1) 'Get the data Get intBMPFile, lngOffset, gudtBMPData() Close #intBMPFile Exit Sub On Error Resume Next 'Dim intBMPFile As Integer Dim I As Integer 'Init variables Erase gudtBMPInfo.bmiColors 'Open the bitmap intBMPFile = FreeFile() Open strFileName For Binary Access Read Lock Write As intBMPFile 'Fill the File Header structure Get intBMPFile, lngOffset, gudtBMPFileHeader 'Fill the Info structure Get intBMPFile, , gudtBMPInfo.bmiHeader If gudtBMPInfo.bmiHeader.biClrUsed <> 0 Then For I = 0 To gudtBMPInfo.bmiHeader.biClrUsed - 1 Get intBMPFile, , gudtBMPInfo.bmiColors(I).rgbBlue Get intBMPFile, , gudtBMPInfo.bmiColors(I).rgbGreen Get intBMPFile, , gudtBMPInfo.bmiColors(I).rgbRed Get intBMPFile, , gudtBMPInfo.bmiColors(I).rgbReserved Next I ElseIf gudtBMPInfo.bmiHeader.biBitCount = 8 Or gudtBMPInfo.bmiHeader.biBitCount = 4 Then Get intBMPFile, , gudtBMPInfo.bmiColors End If 'Size the BMPData array If gudtBMPInfo.bmiHeader.biBitCount = 8 Then ReDim gudtBMPData(FileSize(gudtBMPInfo.bmiHeader.biWidth, gudtBMPInfo.bmiHeader.biHeight)) Else ReDim gudtBMPData(gudtBMPInfo.bmiHeader.biSizeImage - 1) End If ReDim gudtBMPData(FileSizeBMP) 'Fill the BMPData array Get intBMPFile, , gudtBMPData 'Ensure info is correct If gudtBMPInfo.bmiHeader.biBitCount = 8 Then gudtBMPFileHeader.bfOffBits = 1078 gudtBMPInfo.bmiHeader.biSizeImage = FileSizeBMP 'FileSize(gudtBMPInfo.bmiHeader.biWidth, gudtBMPInfo.bmiHeader.biHeight) gudtBMPInfo.bmiHeader.biClrUsed = 0 gudtBMPInfo.bmiHeader.biClrImportant = 0 gudtBMPInfo.bmiHeader.biXPelsPerMeter = 0 gudtBMPInfo.bmiHeader.biYPelsPerMeter = 0 End If Close intBMPFile End Sub Private Function FileSize(lngWidth As Long, lngHeight As Long) As Long 'Return the size of the image portion of the bitmap If lngWidth Mod 4 > 0 Then FileSize = ((lngWidth \ 4) + 1) * 4 * lngHeight - 1 Else FileSize = lngWidth * lngHeight - 1 End If End Function
Bueno, gracias de ante mano!