LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to select activex class programmatically

My code uses PDFCreator through ActiveX. Now there is an update of PDFCreator to 0.9.9, an my code doesn't work anymore. When I right click on the refnum constant and choose "Select ActiveX Class" > Browse, and select the new Type Library (now PDF Creator version 7.1, where the previous version had PDF Creator version 6.1) my code works again.

 

Is it possible to select the activeX class programmatically (f.e. by searching the list for a Type Library that starts with PDF Creator and selecting it?).

 

If this is not possible, is there another way to prevent these changes in the future each time a new version of PDFCreator is made?  

 

Thanks,

 

Nick 

0 Kudos
Message 1 of 4
(3,228 Views)

I'm not sure if a solution exists in LabVIEW...

 

I do not think there is a way to specify a class using a string.  And even then, your property and invoke nodes need to know what specific class they are dealing with in order to function properly (and even compile).

 

That is a tough one.  Typically the ActiveX Type Library of a program does not change from version-to-version unless there were changes done to the ActiveX interface (new or changed properties and methods).

 

If it doesn't look like there is a change in this PDFCreator package, you might want to contact the developers and ask them to have separate versioning of their ActiveX Type Library and their software product.  That way their automation backend can be version 1.0 or whatever and only increment if there is a change in that interface.  If there is a change in the interface it would make sense to then increment the version of the automation backend to 1.1 (for instance). 

 

Another thing that is normal, is to have backwards compatibility between Type Libraries.  For instance, I have ADO 2.8 installed (MS ActiveX Data Objects), but it also installed the Type Libraries from 2.0 -> 2.8.  The 2.0 libraries are compatible with the 2.8 code, but may not have as many features as the 2.8 Type Libraries.

 

I'm a consumer of ActiveX and not one who develops Type Libraries so I may be way off with my statements.  But this has been my experience when working with ActiveX and I don't think that the PDFCreator developers are following what is considered the norm.

 

You may have to regulate the version your users are using, look at an alternative (Microsoft .xps format comes to mind), or rigorously update your code to support all possible versions your users may have.

0 Kudos
Message 2 of 4
(3,141 Views)

The checking that LabVIEW does to make sure your code is correct, is working against you in this case.  In other languages you do something like:

 

MyObject = CreateObject("Whatever 2.3");

 

MyObject.ThatMethod(param, param);

 

MyObject.ThisProperty = SomeValue;

 

etc...etc...

 

So you can trap the error at the CreateObject, and it is left to you as the developer to correctly name the methods and properties defined in the Type Library.  If you get an error at the "CreateObject" line, you can have a loop that increments the version number until you don't get an error (for instance).

 

To me, it seems like since this is possible in other languages it should be possible in LabVIEW....I'm just not sure how to do it myself.

Message 3 of 4
(3,136 Views)

Hi,

changing or choosing activeX classes is not possible in Labview.

 

Regards,

Bas

0 Kudos
Message 4 of 4
(3,097 Views)