Norm Kirchner Posted June 22, 2006 Report Share Posted June 22, 2006 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. Thanks Quote Link to comment
Aitor Solar Posted June 23, 2006 Report Share Posted June 23, 2006 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. Saludos, Aitor Quote Link to comment
Norm Kirchner Posted June 23, 2006 Author Report Share Posted June 23, 2006 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. If that works then thats my solution! I need to create these from scratch. Quote Link to comment
Aitor Solar Posted June 27, 2006 Report Share Posted June 27, 2006 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" . Saludos, Aitor Quote Link to comment
Norm Kirchner Posted June 27, 2006 Author Report Share Posted June 27, 2006 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" .Saludos, Aitor Quote Link to comment
Aitor Solar Posted June 27, 2006 Report Share Posted June 27, 2006 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 . Saludos, Aitor Download File:post-1450-1151419476.llb Quote Link to comment
Norm Kirchner Posted June 27, 2006 Author Report Share Posted June 27, 2006 Attached is the TLI object. See if it works for you, I'm still checking out your code Thanks for picking up the gauntletDownload File:post-208-1151421789.zip Just for my ref How did you find out how to parse the TypeDesc info?? Quote Link to comment
Aitor Solar Posted June 29, 2006 Report Share Posted June 29, 2006 Attached is the TLI object. 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 . If anybody discovers something else, please tell me. Saludos, Aitor Download File:post-1450-1151580411.llb Quote Link to comment
Norm Kirchner Posted June 29, 2006 Author Report Share Posted June 29, 2006 I've found that the specific AX control i'm working w/ does not have a typelib key (IID) within the CLSID section. Breaks the flow of the first program because it assumes it's there. But I used the TLI program to easily to find the TYPELIB ID Quote Link to comment
lvb Posted July 11, 2012 Report Share Posted July 11, 2012 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 . 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? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.