Jump to content

how to get references to all open windows?


blawson

Recommended Posts

Hi all,

I just wrote a little window management script for use while developing. I get a reference to all of the VIs belonging to a target application instance that have an open & visible BD or FP. My initial approach was to get a VI.OwnedApp reference and then get App.AllVIs. I autoindex that in a for loop and get VI refs by name for each element. Then I check each VI's properties to filter it.

This worked swimmingly... and then l I opened a big project with >1k loaded VIs, where it takes several seconds to execute.

Is there a property or method anywhere that will give me a more focused list of names or references? Do I have to filter the list myself?

LV2009sp1, Win7

Link to comment

...Is there a property or method anywhere that will give me a more focused list of names or references? Do I have to filter the list myself?

Can you tell us more what you want to do with the references?

The reason I ask is that there are other ways of getting the BD or FP reference while editing, e.g. if you just want to handle the top most window you can do this with event filtering.

Monitor the private event type "VI activation", and from this you'll get the VI reference as well as a numeric telling you whether the BD or FP was activated.

See attached VI

MonitorActiveVI.vi

/J

Link to comment

Can you tell us more what you want to do with the references?

/J

For now I'm just tweaking window position and size for when I hop around between machines with different display sizes. Ultimately i'd like to save/restore the state of the open windows of a project. The former works pretty well one window at a time, but in order to do the latter, I really need the whole list. Once I benchmarked the individual properties, it was clear that the BD window props are slow, roughly in proportion to the size in memory of the diagram.

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.