Article ID: 141939
Article Last Modified on 6/29/2004
113439 PRB: VB3: Converting MBF to IEEE in Visual Basic for Windows
Instancing: 2-Creatable MultiUse
Name: OLE2MBF2IEEE
Public: True
Private Declare Function cvs Lib "mbf2ieee.dll" _
(x As String) As Single
Private Declare Function cvd Lib "mbf2ieee.dll" _
(x As String) As Double
Private Declare Function mks Lib "mbf2ieee.dll" _
(x As Single) As String
Private Declare Function mkd Lib "mbf2ieee.dll" _
(x As Double) As String
Public Function CvsOle(x As String) As Single
CvsOle = cvs(x)
End Function
Public Function cvdole(x As String) As Double
cvdole = cvd(x)
End Function
Public Function mksole(x As Single) As String
mksole = mks(x)
End Function
Public Function mkdole(x As Double) As String
mkdole = mkd(x)
End Function
Sub Main()
End Sub
This is required because the OLE server must either start in a "Sub
Main" subroutine or in a form. Because a form is not required for this
OLE server, including it would not be a good use of resources.
Startup Form: Sub Main()
Project Name: MBFIEEEServer
Also, in this same tab, select the OLE Server radio button in the
StartMode frame.
Private Sub Form_Click()
Dim fInput As Single
Dim CVSString As String
Dim MBF as New OLE2MBF2IEEE
Dim newresult As String
fInput = 1234.6789 'IEEE format
'Convert from Single to string
newresult = MBF.mksole(fInput)
'Convert from String to single
CVSString = MBF.CvsOle(newresult)
MsgBox CStr(CVSString)
End Sub
140520 PRB: Converting MBF to IEEE in Visual Basic for Windows
Keywords: kbhowto KB141939