Good morning :-)
After a long run of extensive searching and finding great help through the forums, I've hit a roadblock.
I'm trying to control Mach3 through VB.net and have the basic foundation. I'm able to do basically everything I want with the Mach4 COM API, but my problem is that every time I restart my vb.net program, I get an error that says "Cannot create ActiveX control" on the line that reads: mach = GetObject(, "Mach4.Document")
Here is some simple code:
Dim mach As Mach4.IMach4
Dim scriptObject As Mach4.IMyScriptObject
mach = GetObject(, "Mach4.Document")
scriptObject = mach.GetScriptDispatch()
scriptObject.LoadFile("11 CUX56.TXT")
scriptObject.RunFile()
While (scriptObject.IsMoving() <> 0)
System.Threading.Thread.Sleep(1)
End While
If I close Mach3 and restart it after the error, the program runs fine. The problem occurs when I close my vb.net program and reopen it (rebuild it, to be exact) without closing Mach3.
Am I not creating my object properly? Is there a code to reset the control or to close the link to reopen it? If I run the code with Mach3 closed, I get the same error.
I'm guessing it's related, but when I close Mach3 after getting the error, I get a popup box that says "Error Found ,Art Code: 9991, Attempt Recovery?".
Any ideas? Thank you very much in advance!