‎08-03-2022 06:59 AM
In Labiew, I control the external program through the Windows API. At present, I only Find the parent Window through the Find Window function. How to Find the control in the next step?
‎08-03-2022 07:11 AM - edited ‎08-03-2022 07:16 AM
What program is that external program? If it is a LabVIEW built application it has NO Windows control object in a front panel. LabVIEW objects are fully implemented in LabVIEW itself including the drawing of every single pixel of it.
If it is another program it MAY use Windows controls which are implemented as child windows of the main window. In that case you can enumerate them using the according EnumChildWindows() function but this one uses a callback function pointer and that is something you can not do natively in LabVIEW. So you would have to write some external code in C that does the actual enumeration and implements the necessary callback function, put that in a DLL and then call that DLL in LabVIEW.
Alternatively you could look into a software like AutoIt which is meant to automate user interface testing. This software provides much more convenient functions to discover and operate standard windows controls, but doesn't work as conveniently for LabVIEW front panels, since you only can use the screen coordinate based functions to click on a position or enter a keystroke, on which the LabVIEW control hopefully is located.
‎08-03-2022 07:16 AM
‎08-03-2022 07:23 AM - edited ‎08-03-2022 07:23 AM
AutoIt offers such an option. You can execute AutoIt scripts from LabVIEW through SystemExec or using the AutoItX DLL interface, you could create a more interactive access to the AutoIt features, but this will be some serious work.
‎08-03-2022 08:26 AM
My colleague and I made a presentation during NI Week 2018. Hope it useful for you.
UI: Leveraging the Windows API to Extend LabVIEW GUI Capabilities by Jeremy Marquis, Engineering Technical Lead, and George Zou, Project Engineer, G Systems Inc.