Jump to content

Building an ActiveX Class


Recommended Posts

I'm not really sure where this post goes.

Have you ever seen an ActiveX class integrated into LabVIEW? I believe the reports VIs for interfacing with MS Office and things like that use them. The methods and properties are available like a normal property node when using the class reference. These are really slick. I've seen LabVIEW hardware drivers implemented using these so you have the hardware functions available inside of LabVIEW... that kind of thing.

My question is, how do you make one? How do you start from scratch and make something like that? Are there any good references to guide one through the process of making an ActiveX class and/or integrating it with LabVIEW? I'm sure I'll find some stuff on the web about ActiveX but I was wondering if anyone has experience on the LabVIEW integration end of things.

Link to comment
  • 2 weeks later...
I'm not really sure where this post goes.

Have you ever seen an ActiveX class integrated into LabVIEW?  I believe the reports VIs for interfacing with MS Office and things like that use them.  The methods and properties are available like a normal property node when using the class reference.  These are really slick.  I've seen LabVIEW hardware drivers implemented using these so you have the hardware functions available inside of LabVIEW... that kind of thing.

My question is, how do you make one?  How do you start from scratch and make something like that?  Are there any good references to guide one through the process of making an ActiveX class and/or integrating it with LabVIEW?  I'm sure I'll find some stuff on the web about ActiveX but I was wondering if anyone has experience on the LabVIEW integration end of things.

5875[/snapback]

It is very easy to integrate ActiveX classes into LabVIEW. It is pretty easy to make ActiveX classes as well. I've used ActiveX dlls written in VB6, and written and interfaced to ActiveX executables that I have created in LabVIEW. The LabVIEW executables have some upsides and some downsides. The upside is that it is written in LabVIEW and all interfaces to LabVIEW ActiveX executables are the same. This means you can keep the same class number (don't have to update your driver) even if you update your ActiveX app. The downside is that all interfaces to them are the same...you can't specify your own methods and properties. You can't build an ActiveX dll from LabVIEW either.

What I did was write a couple of generic ActiveX drivers for my LabVIEW exe's. One that runs a vi in the exe and waits for it to get done, and one that will keep the vi running and signal back to me when it is complete. All I have to do to communicate is to add the reference to the ActiveX executable and add the same named front panel controls to the vi that calls the driver. It basically works like calling a sub vi. You just pass in the inputs and it passes out the outputs.

If you want the property and methods to be separate then I would suggest using another language to build your ActiveX app. You can also use .NET as it interfaces similar (it has some restrictions) with methods and properties.

If you want to check out some existing classes, you can drop an automation refnum on your front panel (refnum palette in 7.1.1). Right click and select ActiveX class and browse. You then get the type library window where you can select from a multitude of different apps. You will want to choose the select creatable option because you want to create an instance of the application. Then just use the automation open fundamental in the ActiveX palette to open that reference and use the methods and properties to do what you want.

Attached are screen shots of the diagram for the interface vi and one of the general ActiveX drivers I wrote for LV ActiveX application.

post-2966-1126325909.jpg?width=400

post-2966-1126325890.jpg?width=400

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.