Multi-Instance automation

Multi-Instance automation

Postby RJA4000 » Fri Sep 20, 2019 5:25 am

Hi
I've read that we can run multiple instances of Multi Instrument.
I was able to start 2 instances once...
Then next time I tried, the toolasked me to reinstall as default.
I did. Then it worked once... and same message again.

I tried to connect to 2 instance by starting them from API.
But never succeeded. Second instance just doensn't start.

Is there something I miss ?
RJA4000
 
Posts: 96
Joined: Sun Jul 28, 2019 2:28 am

Re: Multi-Instance automation

Postby RJA4000 » Fri Sep 20, 2019 5:38 am

By the way, am I allowed to run 2 instances on the same PC with 1 license ?
Or do I need 2 ?
RJA4000
 
Posts: 96
Joined: Sun Jul 28, 2019 2:28 am

Re: Multi-Instance automation

Postby VirtinsTech » Sun Sep 22, 2019 3:43 am

Multiple instances of MI on the same PC, no matter launched directly or through ActiveX automation API, are allowed with one license.

1. Launched directly
1) If the first instance of MI is launched for the very first time, it will prompt the user to select default device and skin for the first instance.
2) If the second instance of MI is launched for the very first time, it will prompt the user to select default device and skin for the second instance.
....

2. Launched through ActiveX automation API
1) If the first instance of MI is launched for the very first time, it will prompt the user to select default device and skin for the first instance.
2) If the second instance of MI is launched for the very first time, it will prompt the user to select default device and skin for the second instance. The prompt will still show up for subsequent launch of the second instance. The latter is a bug and will be corrected in the next release.

In the next release, these prompts will be always disabled if MI is launched through ActiveX automation API. Configuration of default device and skin can be done through the launched MI HMI or by supplying the configuration file scins.cfg, scins1.cfg.......These configuration files can be configured through MI and obtained from MI's root directly.

ActiveX automation client sample codes can be found in MI's AutomationAPIs folder. Those sample codes will launch only one MI instance. The following shows the modified Visual Basic codes for the launching of two MI instances.

Dim TestMI As Object
Dim TestMI2 As Object

Private Sub Form_Load()
Dim y As Long
y = (ShowMainFrame.Top + ShowMainFrame.Height) / Screen.TwipsPerPixelY * 6 + 32
Set TestMI = CreateObject("MI.Automation")
Call TestMI.Unlock(63066, 31882, 55598, 6380)
Set TestMI2 = CreateObject("MI.Automation")
Call TestMI2.Unlock(63066, 31882, 55598, 6380)
Call TestAutomation.Move(0, 0, 1024 * Screen.TwipsPerPixelX, y * Screen.TwipsPerPixelY)
End Sub

Private Sub ShowMainFrame_Click()
Dim y As Long
y = (ShowMainFrame.Top + ShowMainFrame.Height) / Screen.TwipsPerPixelY * 6 + 32
Call TestMI.MoveWindow(WND_MAINFRAME, 0, y, 1023, 600 - 30 - y, 1)
Call TestMI.ShowWindow(WND_MAINFRAME, SW_SHOW)
Call TestMI2.MoveWindow(WND_MAINFRAME, 0, 600 - 30, 1023, 600 - 30 - y, 1)
Call TestMI2.ShowWindow(WND_MAINFRAME, SW_SHOW)
End Sub

The resulting screenshot is as follows:
MultipleInstanceInActiveXAutomation.png
MultipleInstanceInActiveXAutomation.png (69.47 KiB) Viewed 70385 times
VirtinsTech
Site Admin
 
Posts: 276
Joined: Tue Oct 01, 2013 3:06 pm

Re: Multi-Instance automation

Postby RJA4000 » Sun Sep 29, 2019 9:45 pm

Hi

Thanks for your detailed answer.

First, about the manual start:
I realized that I always tried to start a second instance by clicking on the taskbar MI Icon.
Then I always get the following message:
2019-09-29 15_28_53-MIs.png
2019-09-29 15_28_53-MIs.png (36.12 KiB) Viewed 70247 times


But when I use the desktop Icon, all works well.
Strange...

By the way, that doesn't solve my issue: When I started either DAC or ADC, both devices are set to same sampling frequency...
See my other post about this.

Second,
here is my code
My normal Initialize procedure. Works fine.

Public Sub Initialize()
objType = System.Type.GetTypeFromProgID("MI.Automation")
MIautomation = System.Activator.CreateInstance(objType)
MIautomation.Unlock(&HF65A, &H7C8A, &HD92E, &H18EC)
MIautomation.ShowWindow(nWindowID.WND_MAINFRAME, nCmdShow.SW_SHOWMAXIMIZED)
ReDim MyDeviceLevels.ChannelLevels(1)
End Sub


The 2 Multi-instance ones. Doesn't work.

Public Sub InitializeDAC()
Try
objType = System.Type.GetTypeFromProgID("MI.Automation")
MIDAC = System.Activator.CreateInstance(objType)
MIDAC.Unlock(&HF65A, &H7C8A, &HD92E, &H18EC)
MIDAC.ShowWindow(nWindowID.WND_MAINFRAME, nCmdShow.SW_SHOW)
Catch Exc As Exception
LogError(Exc,
System.Reflection.MethodBase.GetCurrentMethod.DeclaringType.Name,
System.Reflection.MethodBase.GetCurrentMethod.Name,
0, 0, 0, 0)
End Try
End Sub

Public Sub InitializeADC()
Try
objType = System.Type.GetTypeFromProgID("MI.Automation")
MIADC = System.Activator.CreateInstance(objType)
MIADC.Unlock(&HF65A, &H7C8A, &HD92E, &H18EC)
MIADC.ShowWindow(nWindowID.WND_MAINFRAME, nCmdShow.SW_SHOW)
Catch Exc As Exception
LogError(Exc,
System.Reflection.MethodBase.GetCurrentMethod.DeclaringType.Name,
System.Reflection.MethodBase.GetCurrentMethod.Name,
0, 0, 0, 0)
End Try
End Sub
RJA4000
 
Posts: 96
Joined: Sun Jul 28, 2019 2:28 am

Re: Multi-Instance automation

Postby VirtinsTech » Tue Oct 01, 2019 10:58 pm

This error message "Please uninstall and then re-install the software using the original setup file, or contact Virtins Technology at...." will pop up if the configuration file scins.cfg is somehow incompatible with the current MI version. If it pops up for the second instance only, then an incompatible configuration file scins1.cfg exists somewhere. Deleting that file will allow the software to create a new and compatible scins1.cfg automatically after launching the second instance.

With the second instance launched, reconfigure both [Setting]>[ADC Device] and [Setting]>[DAC Device] so that they point to a different sound card than the first instance, then the two MI instances should allow you to change the sampling rate independently.

Your C# ActiveX Automation Client code that launches two MI instances are correct. But there is a bug in the current MI V3.8.5.2 which prevents the launch of the second instance under Windows 10, although it does work under Windows XP as shown in the previous post. This bug has been fixed in our internal working version.
VirtinsTech
Site Admin
 
Posts: 276
Joined: Tue Oct 01, 2013 3:06 pm

Re: Multi-Instance automation

Postby RJA4000 » Wed Oct 02, 2019 4:52 pm

Thanks !
RJA4000
 
Posts: 96
Joined: Sun Jul 28, 2019 2:28 am


Return to Questions

Who is online

Users browsing this forum: No registered users and 20 guests