09-18-2013 12:25 PM
All,
Let's say I have two files withe the same file extension. One of the files opens only with one particular program whereas another file opens only with another program.
So I was wondering, by using LabVIEW , if there is a way to tell (programatically) to which program are each of these files assigned to.
I am not quite sure if there is something that can be done by using WINAPI or .NET?
Please help
Thank you
09-18-2013 01:27 PM
Open both files in a hex editor and look for distinctive patterns in the header- for example you may find the files have a fixed string in a fixed position in the first few bytes that identifies the file type. You can then use a binary read in LabVIEW to identify the files by these features.
Not the easiest solution, but the only one I know.
09-18-2013 01:38 PM
You can read the registry to get the program description. The extensions would need to be registered already (or exists already) in order for this to work. See example attached.
09-18-2013 02:56 PM
Thanks guys for the fast response.
SumTumWong,
I have tried out your idea however if I take a file extension it always finds the same program and Registry Value for both of the files. What I think is happening is that two programs (Program#1 and Program#2) are installed on the computer that have the same file extension association. Since Program#2 was installed most recently by default any file that was originally created by Program#1 fails to open up in Program#2. So I would like to tell the difference programmaticlly by using LabVIEW. So somehow I need to get the information about each file that will describe with what Program was each file created.
Thanks,
09-18-2013 09:24 PM
The only way you are going to be able to do that is if there is something within the file itself that gives an indication what program might have saved it.
For example, in the header for an .xls file, there is probably something that describes it as Microsoft Excel, perhaps even the version of Excel, that was put there when Excel saved it. But if you have another program save the file, let's say notepad was used and the user picked .xls as the file extension, then there is nothing that will describe that Notepad saved it.
But all of this is basically what ToeCutter was already telling you.
If you need more help, then you will have to provide more information such as what types of files and what programs were used that got their file extensions mixed up.
09-19-2013 10:55 AM
RavensFan,
Thanks for your response.
I agree with you that at this point the only way to figure out what file belongs to which program is by reading its contents and trying to find out any description that has any relationship to a specific program. So I did that and luckily I was able to figure out which file belongs to which program.
Thank you guys for these great advices !!!