10-28-2022 04:21 PM
I compiled a labview project to an executable file, say "example.exe"
When I'm running example.exe, I can click to open my tdms data file.
However, I would like the option to double click on the tdms data file, the example.exe would be called to open my file.
(just like when double-clicking docx file from Explorer, Microsoft Word will open)
Can someone post a VI here on how to do that?
10-28-2022 04:42 PM - edited 10-28-2022 04:44 PM
I don't have a VI to share, but the solution requires two parts:
The first is letting Windows know that you have a program to open the file type. You could do this by defining a shell extension / context menu handler to point to your executable: https://learn.microsoft.com/en-us/windows/win32/shell/fa-verbs#register-an-application-to-handle-arb...
Inside your VI, you can then access the command line parameters used to call the executable: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YHdICAW
This way, when the "Open" verb is called on the registered file, Windows executes your executable and adds the file name to the command line parameters. You can then read the path of the file to open and continue from there.
10-29-2022 09:55 AM
it works beautifully.
On the 1st part, I did it manually.
I'm wondering if there is an option I can modify the Build Specifications so that when I build my "example.exe" or Example Installer, Windows will automatically assign my application to handle tdms file? (i.e., for my users not have to do the 1st part manually).
Thank you.
10-29-2022 10:58 AM
@ngthai wrote:
it works beautifully.
On the 1st part, I did it manually.
I'm wondering if there is an option I can modify the Build Specifications so that when I build my "example.exe" or Example Installer, Windows will automatically assign my application to handle tdms file? (i.e., for my users not have to do the 1st part manually).
Thank you.
Yes, you can, you have to associate your application as the default application for that FileType in Windows Registry
10-29-2022 04:05 PM
Thank you. Your suggestions means that my users still need to do "registry entries" manually, which I did and it already worked.
My need is: My users, after installing my executable installer, will not have to do any registry changes (in Windows).
My question is: In Labview Build Specs, is there any option to build that registry changes into the installer package?
10-29-2022 05:35 PM
Yes, you can configure the necessary registry changes when you build your installer.
See this thread for some hints on how to do it:
https://forums.ni.com/t5/LabVIEW/Registry-Items-for-Custom-File-Extensions/td-p/4038048
10-31-2022 08:32 AM - edited 10-31-2022 08:34 AM
Here is an example I saw years ago.
I also have used InnoSetup for years, and it has a feature where you can have it launch a program with a file extension as part of the installer.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
10-31-2022 10:52 AM
FYI, you can definitely break stuff if you mess with the registry. Definitely make a backup using regedit before you change things, otherwise you could wind up not being able to open folders anymore 🙂
See this thread for some info: