Hi, We have an Vibration Crontroller application that has is no DLL and no ActiveX support. I want to detect when that or any Windows application opnes a Windows "Open File Dialog" box. I'd then like to detect what file or folder was selected. Is that possible with LabVIEW? Thanks.
If any other application opens a Windows "Open File Dialog" then your LabVIEW application that is running will not have a reference for that. That kind of operation might also attract the attention of a anti-virus software. I'm not sure if it is entirely impossible, but seems improbable to me.
Could you give more details as to what it is your are trying to accomplish? For instance, if Microsfot Word opens a file dialog and the user selects a file or files in that dialog, what bennefit is that to you and your LabVIEW application? If the LabVIEW application requires files to be pointed to, can this be done with a standard file browser control from within LabVIEW?
To take my example in Microsoft Word a step further, a lot of applications (like Word) have VBA or some other scripting support. If there is a particular application you have in mind that you are interested in the output of its file dialog box, then there may be a way to get the application to send the file name and path data to your LabVIEW application. Setting up your LabVIEW application to listen and watch what all other applications are doing seems like a security issue to me.
I'm with Nickerbocker on this - not sure if impossible, but seems improbable. The only thing I could find is this handy API to help determine the names of all the currently open windows by calling into the Windows API. However, I tried to see if it could detect the Open File Dialog with Microsoft Word, but it can't and the dialog was essentially "invisible" to this API. Maybe other programs are different, but that's highly unlikely.
Windows API Function Utilities (32-bit) for LabVIEW
If I find anything else I'll post back, but hopefully this helps in some roundabout way.
For one target, you have to create a dll, inject into the target process. Just like a virus.
For all targets, replace the Windows function (OpenFileDialog), with yours. Google for hook Windows API.
You will have to use C/C++ to do this.
use Windows API FindWindow. Use Call Library Function node in LabVIEW.
From the window handle, you can get its process id. So you can determind if the window belong to the target.
Alternatively, disable the open function from the application.
Build a LabVIEW GUI, force user to open from your GUI instead.
Then send the message to the application.
You can find the last file using the following method, the constitution of MRUListEx in registry is not documented (not that I could find anyway) so you will need to use discretion. Also you will need to figure out a way to detect the change event.
I think I'll try that. Can you further explain the "shell32.dll:SHGetPathFromIDList"? The Numeric Array and the String? I'm not sure how to configure those parameters.
That routine decodes the binary data from registry to file path.
Basically, the first byte of MRUListEx listing in registry is the index of last accessed file in the file list in the sub key. If you open up your registry and navigate to the key, you will figure it out.
Also you can drag and drop snippets on to your block diagram, if that doesnt work, save the png file to your computer and then drag and drop.
Hello again aCe,
I get error -603 "Specified key or value does not exist" after Open Registry Key.vi.
Here is what I have in the String Constant:
For File Ext without period (*) I have "DAT". (no quotes)
The file extension in question is DAT.
What happens if you try * or jpg in the extension field?
I suspect you are having trouble becuase dat extension may not be assigned to a program and hence there is no entry in the registry.