Jump to content

Link Automation Ref - To ActiveX Object

Recommended Posts

I bet you can't figure this one out.

I'm looking for a way to programatically "Select ActiveX Class" for a created Automation Refnum.

The only direction I can see right now, is hack into the type descriptor / andor create one from sctratch and use the create contorl from type desc vi to make it.

Any ideas.

The purpose is to create an "All Objects" vi that has a refnum for each of the possible, not just creatable, objects.


Link to comment

It's curious, I'm working right now in something very similar :)

I haven't found any way of select the ActiveX class by scripting, because with typecasting you can only make it a generic refnum, nothing more specific. As my needs are simpler than yours (I just need to programmatically adapt an ActiveX refnum to a specific type from a reduced list), I have tried replacing it with a predefined control and, of course, it works. Not very elegant, but effective.

Now, in the type descriptor you do have the CLSID of the ActiveX class, as it appears in the Windows registry (starting from position 12, I think), so I'll give it a look.



Link to comment
If that works then thats my solution!

I need to create these from scratch.

Confirmed, it can be done. But it's not straightforward for all kind of objects, unfortunately. All of my objects have well defined registry entries so I have implemented an ActiveX-refnum creation wizard and it works great, but I suspect the generic way would be not searching the registry for all the data, but calling a method in the type library dll, probably DllGetClassObject, and retrieving the info directly.

You will need to know the object's CLSID, its TypeLibrary and its Interface (surprisingly, that seems the really important parameter) to build the typedesc array, as the other array elements are constant. Tell me if you discover a better way of retrieving that three parameters, of if you need more info on my "experiments" :D .



Link to comment

There is an activeX object called "TypeLib Information Ver 1.0"

I do not know how this go onto my system, but you can get all the guts through this interface.

If you can tell me how to get to the registry location of THIS AX object, i'll dig and let you know how to get it.

care to post your prototype?

Tell me if you discover a better way of retrieving that three parameters, of if you need more info on my "experiments" :D .



Link to comment

I don't see that object (TypeLib Information Ver 1.0), but I have prepared a working tool ;) .

I think it's of easy use, I hope it's useful.


1) Click on "Generar lista" to generate the ActiveX classes list for your computer.

2) Select a class. First try to create a common class like InternetExplorer.Application for test, because depending on what registry entries have that class, the program maybe unable to create an object. If it's able, the controls in the inferior panel will be enabled and the led will be on green. If not, the led will be on red and you'll see only the registry keys the program can recover. This can be slow, depending on the machine and the number of defined interfaces.

3) Select an available interface. Not all can be created, though I don't know why yet. Select a common one for test.

4) Select an existing VI. The program will create an ActiveX refnum in that VI. It doesn't have to be open.

5) Click on "Generar objeto" to create the object. Even if you see the object, check it to see it goes to the right class.

As you can see, it still needs a lot of improvement :unsure: .



Download File:post-1450-1151419476.llb

Link to comment
  • 6 years later...

OK, now it has more sense! I have prepared an improved version; it works fairly well, but I still detecting problems with some objects when several versions are installed blink.gif . If anybody discovers something else, please tell me.

I hate to resurrect old posts, but this tool is not working on my Win7 32-bit system with LabVIEW 2011 SP1. Norm/Aitor - What version of LabVIEW and Windows did you have this working on?

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.

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.