Dear Barry,
thank you for your effort when testing this case in your Visual Basic application. Let me summarize the features of the MCB.MULT object and what is working and what is not working in FreeMASTER 3.1.2:
- Both FreeMASTER and the MULT object need to registered as COM reference in VB project before use.
- McbPcmLib can be located as “FreeMASTER ActiveX Type Library”.
- McbMultLib must be located in mmaster.dll file in FreeMASTER installation.
- The VB project must be compiled for x86 platform.
- The MULT object is created as “new McbMultLib.McbMult” object.
- The GetAppObject() works well to fetch the named running instances of FreeMASTER.
- When the required instance is not running, it can be automatically launched by using 2nd parameter value of the GetAppObject().
- Launching the new instance may sometimes be slower than expected and the GetAppObject() returns a null value prematurely. An extra timeout loop may be needed as provided in the example VB code below.
- Working with FreeMASTER object returned by GetAppObject() is then without any issues. Refer to FreeMASTER User Guide for a complete reference of the ActiveX interface.
The same experiment with Visual Basic for Applications (VBA) in Excel shows that the MCB.MULT access to system’s Running Object Table is limited in this framework. VBA apparently cannot fetch the objects registered under so-called “objref monikers”. This is the reason the VB code below will NOT work in VBA with FreeMASTER 3.1.2.
Changes to be included in FreeMASTER 3.1.3:
- Support for 64bit applications will be added by new mmaster64.dll and by new 64bit proxy-stub libraries wrapping the FreeMASTER object. The FreeMASTER will remain to be 32bit application.
- VBA language will be supported in Excel and other similar environments. The FreeMASTER instances will also use another method to register themselves in system’s ROT which will be compatible with VBA. The MULT object will be updated to try both ways to fetch the object.
Below, you can see a screenshot of a simple VB project edited in Visual Studio 2019. Pay special attention to highlighted parts. The full code snippet is also copied below.
Thank you again for your cooperation,
Michal

Private Sub OnTest1(sender As Object, e As EventArgs) Handles ButtonTest1.Click
' add the following COM Dependencies:
' McbPcmLib as FreeMASTER ActiveX Type Library
' McbMultLib - browse for mmaster.dll in FreeMASTER installation
Dim mult As McbMultLib.IMcbMult
Dim a, b As McbPcmLib.IMcbPcm
Dim vVal, tVal, msg As Object
mult = New McbMultLib.McbMult
' see pcmaster.exe /help for startup flags
' &H01=start freemaster if needed
' &H10=close port, &H20=open port
a = mult.GetAppObject("A", &H21)
b = mult.GetAppObject("B", &H11)
' wait up to 10 seconds for instance fully initialized
' this step should not be needed in FreeMASTER 3.1.3 anymore
For i = 1 To 10
If IsNothing(a) Or IsNothing(b) Then
Threading.Thread.Sleep(1000)
a = mult.GetAppObject("A")
b = mult.GetAppObject("B")
Else
Exit For
End If
Next
' both instances should be valid now
If IsNothing(a) Or IsNothing(b) Then
MsgBox("Error: timeout when connecting to FreeMASTER")
Exit Sub
End If
' open port and load example project (assuming fmstr_uart default demo app)
a.StartStopComm(True)
a.OpenProject("fmstr://demo.pmp.zip")
' read variable from the running instance
If a.ReadVariable("var16", vVal, tVal, msg) <> 0 Then
MsgBox("From instance a " + tVal)
Else
MsgBox(msg)
End If
' exit both instances
a.Exit()
b.Exit()
End Sub