If the button that you need to press in the dialog box has focus, you can also close the window by pressing the Enter key. Thus, if you simulate the pressing of the Enter key, the dialog box will be automatically closed. It is possible to generate a key stroke programmatically by using the Windows keybd_event
function in the user32.dll
. You can find examples in Community Example: Programmatically Simulate Key Strokes in LabVIEW
However, common Windows dialog boxes or user prompts (like most LabVIEW dialog boxes) are modal, thus they will halt execution of the current application while waiting for user input. To be able to simulate the pressing of the Enter key while the dialog box is opened, you have to make LabVIEW application window to always be on top. To achieve this follow the instructions on the How Do I Configure My LabVIEW Application Window to Always Be on Top?