Machsupport Forum

Mach Discussion => Mach SDK plugin questions and answers. => Topic started by: DiyAddict on October 23, 2010, 01:47:50 PM

Title: Automating Mach from VB6
Post by: DiyAddict on October 23, 2010, 01:47:50 PM
Hi everyone,
I'm trying to automate Mach from a VB6 program. Can anyone point me in the right direction?

Thanks in advance
Title: Re: Automating Mach from VB6
Post by: DiyAddict on October 23, 2010, 04:12:52 PM
Ok, after searching around, I've seen a couple of examples of code similar to the following:

Create a reference to mach3.exe, then:

Public objMach As mach4.IMach4                                          'Access the embedded type library

Private Sub test()                                                               'Simple test sub

    Set objMach = GetObject(, "Mach4.Document")                     'Create the object
    objMach.LoadGCodeFile "c:\mach3\gcode\roadrunner.tap"        'Load Gcode

    Set objMach = Nothing                                                       'dereference Mach3 object

End Sub

My problem is that each time this program gets to the GetObject line, I get an error message "Runtime error 429: ActiveX component can't create object"

I know that Mach3.exe is properly referenced, because it's interface's methods and events show up.

No one else has reported this problem, so here's my question: Am I getting this error because I'm using the trial version of Mach 3?

VB6 says something about this error occuring when a license key is not found.

Any light you can shed on this matter would be greatly appreciated

Title: Re: Automating Mach from VB6
Post by: DiyAddict on October 25, 2010, 07:09:17 AM
I think I've found the problem - it seems that the latest version of Mach3 (3.042.040) never creates the registry entry Mach4.Document, which is needed for the automation object to work.

The solution is to install version 2.63 first, then run it once, then install the latest version.

I'd be interested in comments - has anyone else had similar problems?
Title: Re: Automating Mach from VB6
Post by: db1 on June 23, 2015, 02:18:53 PM
Do you have a hyperlink to the Mach version that will add the reference? I can only find the newest version on the Machsupport website
Title: Re: Automating Mach from VB6
Post by: dz32 on February 11, 2016, 07:47:15 PM
if you are running windows XP, put the following text into a file name test.reg and then double click on it to add it to the registry.

Code: [Select]
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Mach4.Document\CLSID]
@="{CA7992B2-2653-4342-8061-D7D385C07809}"

I have not yet had time to test on win2k or win7 yet but on XP this always solved it for me
also Mach must to be running when you call GetObject()