Jim Kring Posted February 18, 2007 Report Share Posted February 18, 2007 Does anyone know how to detect whether a VI is calling an XControlLibrary instance (an XControl) and obtain a reference to the XControlLibrary? The XControlLibrary does not show up as in the callees list. It is possible to test all Front Panel controls using the XContro::Is XControl? property but this does not give any information about or link to the XControlLibrary. It is also possible to get this info from the linker info on disk, but I would like to do this all using VI Server, in memory. Quote Link to comment
Tomi Maila Posted February 19, 2007 Report Share Posted February 19, 2007 QUOTE(Jim Kring @ Feb 18 2007, 12:59 AM) Does anyone know how to detect whether a VI is calling an XControlLibrary instance (an XControl) and obtain a reference to the XControlLibrary? The XControlLibrary does not show up as in the callees list. It is possible to test all Front Panel controls using the XContro::Is XControl? property but this does not give any information about or link to the XControlLibrary. It is also possible to get this info from the linker info on disk, but I would like to do this all using VI Server, in memory. I don't have a complete answer to you. I did'n quite get it where from did you try to get the XControl reference. From VI where the XC instance is located? Anyhow, you can find out which XControl your control is by getting it's class name using property node. You can find which libraries are in memory of all the applications using property All Libraries in memory of Application. But I still don't know how to get a reference to the library unless you also know the path of the library. If you know the path of the XControl, then it's easy. If you know the name of a Facade.vi then you can open a VI reference to Facade directly from memory by wiring the long name to open VI reference. But I assume you don't in general know this information. Jim, tell me more about the linker info on the disk. What is it and where can I find it and how can I use it. Tomi Quote Link to comment
Jim Kring Posted February 19, 2007 Author Report Share Posted February 19, 2007 QUOTE(Tomi Maila @ Feb 18 2007, 10:43 AM) Jim, tell me more about the linker info on the disk. What is it and where can I find it and how can I use it. Tomi, Linker info are the path dependencies on other LabVIEW files (and non-LabVIEW files, such as DLL, help, etc). You can read this information from file, rather than trying to do it in memory -- often this is easier, for a variety of reasons. You can read the linker info by using the Application method Linker.Read Info From File. This is made available, via the SuperSecretPrivateSpecialStuff=True LabVIEW.ini key. See the image and VI, below. Download File:post-17-1171828234.vi Note: You can also write to the linker info of LabVIE files by using the Linker.Write Info To File method, but this is quite a bit trickier and has dangerous implications. Thanks, -Jim Quote Link to comment
Tomi Maila Posted February 20, 2007 Report Share Posted February 20, 2007 Thanks Jim, You can get link from a VI to the XControl library: XControlName=Control.Class Name AllVIs=Application.All VIs in Memory For each VI in AllVIs { if (VI match XControlName) resultVI=VI } XControlLibrary = resultVI.Library You can get the link from an XControl to Owning VI ContainerState.Refnum.OwningVI Tomi Quote Link to comment
Jim Kring Posted February 20, 2007 Author Report Share Posted February 20, 2007 QUOTE(Tomi Maila @ Feb 19 2007, 01:01 AM) You can get link from a VI to the XControl library [snip...]You can get the link from an XControl to Owning VI [snip...] Tomi, That looks like it will work great. Thank you! -Jim Quote Link to comment
Ton Plomp Posted February 20, 2007 Report Share Posted February 20, 2007 Hi Jim/Tomi, the following code works: I had to extend {VI match XControlName} Ton 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.