Hello Guest it is July 13, 2024, 10:40:04 AM

Author Topic: Automating Mach from VB6  (Read 15191 times)

0 Members and 1 Guest are viewing this topic.

Automating Mach from VB6
« 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
Re: Automating Mach from VB6
« Reply #1 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

Re: Automating Mach from VB6
« Reply #2 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?

Offline db1

  •  2 2
Re: Automating Mach from VB6
« Reply #3 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

Offline dz32

  •  14 14
Re: Automating Mach from VB6
« Reply #4 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


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()