LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX controller methods import as callbacks

I used the Create ActiveX Controller feature to create a FP.  The ActiveX is part of Mach3, a CNC control program.  The ActiveX has methods like Code(LPCTSTR) that allows you to send G-Code strings to the CNC machine (G-Code is a text-based motor control language).
 

The weird thing is that most of the methods in the ActiveX control were imported as events with callbacks.  For example, the only reference to the Code function in the FP is under Event Callback Registration Functions->IMyScriptObject->IMySriptObjectRegOnCode.  The prototype for the callback includes a char * which I assume maps to the LPCTSTR parameter.
 

I don't understand why the methods are imported as callbacks.  I've been working with Mach3 tech support, but they don't know anything about CVI. Here's what they told me about their server:
 

There are two interfaces that you can get into... One is called Mach4 the other is MyScriptObject, The My script object is all the methods that are used in the VB scripting in Mach3... when I wrap the class in VS I can select what set of objects I would like to get... I am not sure how you do it without VS..

 

All the methods under Mach4 are imported as standard function calls.  Why would the "My script object" methods be imported as callbacks?  Is there some way to fix this in CVI, or is the problem in the ActiveX server itself?

 

0 Kudos
Message 1 of 21
(6,574 Views)

Based on this document http://zone.ni.com/reference/en-XX/help/370051K-01/cvi/cviautomation_controller_advanced_o/ CVI should only generate a callback:

For each event object you select, the wizard generates a set of functions you can use to register callbacks for each event. LabWindows/CVI calls the callbacks when the server generates the events.

 Can you post a link to the exact software you are installing and attempting to call through CVI ?
 

What version of CVI are you using?

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 2 of 21
(6,550 Views)

Richard,

 

There's a download link to the exe here: http://www.machsupport.com/downloads.php.  I don't know if you can run it as an eval copy or not.  If not, I can ask their tech support people for permission to temporarily give you a copy of our license file.

 

I understand that CVI will create callbacks or events, but the functions I need to call are not events.  They are asynchronous calls generated by my program.  According to Mach3's support, in VS these functions show up as callable methods, so I don't understand why they are mapped as callbacks in CVI.

 

Tony

0 Kudos
Message 3 of 21
(6,547 Views)
I downloaded the link, i'm waiting on a time when i can restart my computer before I will be able to generate an ActiveX controller.
Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 4 of 21
(6,513 Views)

TonyG,


I receive an error when trying to generate a controller... I downloaded an installed the Mach3 R3.042.032 and then restarted my computer. Is there anything else that must be done?

 

 

 

2009-12-17_163944.jpg

Message Edited by Snowman 6008 on 12-17-2009 04:42 PM
Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 5 of 21
(6,495 Views)

I have an additional entry in my list named Mach4 that has the interfaces in it.  I'm not sure why I see that and you don't.  I'll ask their tech support about it.

 

Tony

0 Kudos
Message 6 of 21
(6,488 Views)

Richard,

 

The Mach supprto guy was stumped.  However, he did give me permission to send you the version of the program I installed, which is r3.042.020.  It might give you different behavior either because it's a different version or becuase it's a licensed copy.  The is 26MB.  Can you provide an FTP location to upload it to?

 

Tony

0 Kudos
Message 7 of 21
(6,472 Views)

Tony,

 

You can put it on ftp://ftp.ni.com/incoming please zip it and name the zip file 1463367.zip and post back here when it is on the site. I am using Windows XP service pack 3 and CVI 9.0. 

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 8 of 21
(6,465 Views)

The file is uploaded.  Hopefully this will work better.

 

Tony

0 Kudos
Message 9 of 21
(6,461 Views)

After installing the software i was able to generate a controller, and for the "Code" function i generated a callback called Mach4_IMyScriptObjectRetOnCode. Have you been able to call this ActiveX server in another language such as C#? If so can you provide a very simple example of how to do this?

 

CVI generates functions from the wizard automatically based on their types and something in the Mach4 library is either being treated as an event callback or is not being recognized properly. 

 

 

 

2009-12-21_163958.jpg

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 10 of 21
(6,415 Views)