Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

the old MBF (Microsoft Binary Format) ?

Status
Not open for further replies.

donutman

Programmer
Dec 20, 2002
2,481
US
I've got this problem. I've got to interface a VB6 program with an old quickbase radom access file that has single precision values stored in the old MBF (microsoft binary format) instead of the new IEEE-32 format. Well microsoft did make a 16-bit dll that converted them, but that requires VB4 to use it.
I have three choices (given my level of programming knowledge)
1) find an old copy of VB4 and install it on a W95 machine and write a 16-bit OLE application server for the 16-bit dll. Then I can call the OLE server from VB6.

2) find someone who can take the source code for the 16-bit dll that is written in C and port it to a 32-bit dll. It's a very small file on MS website at
3) If I had some documentation on how the MBF works, then I (being a math major) could find a way to do the bit math within a VB6 app myself. I'm pretty sure this would get pretty nasty.

I suppose there's one other approach, but I can't think of a way to implement it. I could write and compile a quickbasic (PDS 7.0) subroutine or program that is capable of reading MBF single precision values and try to call it from VB 6.0. But as I said, I don't think VB can interface with QB?
 
I'd start here:


This page gives the MS DLL's logic, both in Borland C and in Delphi. I think you'll find comments in the C code that document the layout of MBF floating-point values pretty well along with IEEE floats.

If I had your problem, I'd just compile up the Delphi into a 32-bit DLL. If I lacked a Delphi compiler I'd probably take a stab at converting the Delphi to VB rather than messing with the C version. Before this I'd take a close look at both versions though to be sure they do the same thing and that it is consistent with the described layouts of both formats.

All you need is MBF2IEEE right? Should be a piece of cake. Ugliest part in VB is treating a Single as a byte array. Several techniques can be used, there is one here:

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top