LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to resolve same file extensions conflict using LabVIEW ?

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  

0 Kudos
Message 1 of 6
(3,110 Views)

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.

0 Kudos
Message 2 of 6
(3,090 Views)

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.

 

Front Panel.png

 

Block Diagram.png

0 Kudos
Message 3 of 6
(3,081 Views)

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,

0 Kudos
Message 4 of 6
(3,057 Views)

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.

0 Kudos
Message 5 of 6
(3,041 Views)

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 !!!

0 Kudos
Message 6 of 6
(3,011 Views)