How to execute an external program based on file extension
-
Hi all, I have an MFC program that (amongst others) stores some files with different types (like .msg, .doc, .eml etc) When the user selects one such files, I would like to start the relevant software to open that file much like what happens when I doubleclick on a file from the explorer. How do I do such a thing? (one: how do I find-out which program to start based on the file's extension and two: what is the easiest way to start that program?) Thanks in advance William
-
Hi all, I have an MFC program that (amongst others) stores some files with different types (like .msg, .doc, .eml etc) When the user selects one such files, I would like to start the relevant software to open that file much like what happens when I doubleclick on a file from the explorer. How do I do such a thing? (one: how do I find-out which program to start based on the file's extension and two: what is the easiest way to start that program?) Thanks in advance William
-
Hi all, I have an MFC program that (amongst others) stores some files with different types (like .msg, .doc, .eml etc) When the user selects one such files, I would like to start the relevant software to open that file much like what happens when I doubleclick on a file from the explorer. How do I do such a thing? (one: how do I find-out which program to start based on the file's extension and two: what is the easiest way to start that program?) Thanks in advance William
ShellExecuteEx() would automatically open the associated program based on the file type.
-
Hi all, I have an MFC program that (amongst others) stores some files with different types (like .msg, .doc, .eml etc) When the user selects one such files, I would like to start the relevant software to open that file much like what happens when I doubleclick on a file from the explorer. How do I do such a thing? (one: how do I find-out which program to start based on the file's extension and two: what is the easiest way to start that program?) Thanks in advance William
I know you mean "execute" in a computing context, ie "run". But I had a different picture when I saw your subject heading. exe -> *Bang!* txt -> *chop!* doc -> *defenestrate!* Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
-
I think you're looking for the ShellExecute[^] API.
Thanks a lot. This indeed solved my issue. Regards, William
-
I know you mean "execute" in a computing context, ie "run". But I had a different picture when I saw your subject heading. exe -> *Bang!* txt -> *chop!* doc -> *defenestrate!* Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
Although there are definately certain files that I would gladly *kill*, *exterminate*, etc You are right in assuming that my question was intended to be boringly technical.