Jump to content
Sign in to follow this  

Objcreate("adodb.stream") Problem

Recommended Posts

I'm stumped...I'd figured this would help me read/view binary files. At least allow me to load the file to a variable and add, edit and delete. MsgBox() shows nothing...Possibly Hex 05 in the third position is my trouble in the file.

;Use ADO to read binary data...
Dim $ReadBinaryFile, $FileName

$FileName = InputBox("Read Binary File","Enter Path/Filename for binary read")


MsgBox(4096,"ReadBinaryFile Function"," " & $ReadBinaryFile)

Func ReadBinaryFile($FileName)
  Const $adTypeBinary = 1
  $BinaryStream = ObjCreate("ADODB.Stream"); Create ADODB.Stream object

  $BinaryStream.Type = $adTypeBinary; Set ADODB.Stream.Type to BINARY

  $BinaryStream.Open; Open the stream

  $BinaryStream.LoadFromFile = $FileName; Load the file data from disk to the stream object

  $ReadBinaryFile = $BinaryStream.Read; Open the stream And get binary data from the object
  Return $ReadBinaryFile

Share this post

Link to post
Share on other sites

I've tried FileRead(),FileGetSize(),and StringLen() in an earlier attempt at getting binary data.

Windows says the file is 780 bytes; StringLen() reports 2, FileGetSize() reports 0, FileRead() and FileReadline() state the file is not an accessible type.

There isn't much in the file...a couple of control codes and a bunch of IP/URL addresses. The file is easily edited with a HexEditor.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...