Default program of file.
-
Hello friends, can we get default program of file specified. E.g. default program for .mp3 file may be windows media player/winamp like that. Is there any method which gives such details of default program. thanks in advance. Rahul Kulkarni
You get that info via the registry, I don't know of a method that will look it up for you, however.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
You get that info via the registry, I don't know of a method that will look it up for you, however.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
To see how this information is stored in the registry, you may want to read what Microsoft has to say about file types[^].
-
You get that info via the registry, I don't know of a method that will look it up for you, however.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
This page (http://msdn2.microsoft.com/en-us/library/aa969375.aspx[^]) describes the keys used.
Vasudevan Deepak Kumar Personal Homepage Tech Gossips
-
This page (http://msdn2.microsoft.com/en-us/library/aa969375.aspx[^]) describes the keys used.
Vasudevan Deepak Kumar Personal Homepage Tech Gossips
I can't see that it does. The page you point to describes how the Default Programs API works, i.e. how to tell windows the capabilities of a certain application.
-
Hello friends, can we get default program of file specified. E.g. default program for .mp3 file may be windows media player/winamp like that. Is there any method which gives such details of default program. thanks in advance. Rahul Kulkarni
MyComputer\HKey_Classes_Root\AudioCD\Shell\Play\Command Check it
Arun Kr
-
Hello friends, can we get default program of file specified. E.g. default program for .mp3 file may be windows media player/winamp like that. Is there any method which gives such details of default program. thanks in advance. Rahul Kulkarni
as I know it can be retrieved with shell32 FindExecutable API but sometimes the results is not like what is Expected Maybe this going to help
class Shell32Utils { const int FILENOASSOCIATED = 31; const int FILENOTFOUND = 2; const int PATHNOTFOUND = 3; const int SUCCESS = 32; //and longer const int BADFORMAT = 11; [DllImport("shell32", EntryPoint = "FindExecutable")] static extern int FindExecutable(string file, string directory, [MarshalAs(UnmanagedType.LPStr)] StringBuilder result); public static string Find(string file) { string fileName=System.IO.Path.GetFileName(file); string filePath = System.IO.Path.GetDirectoryName(file)+"\\"; System.Text.StringBuilder res = new StringBuilder(1024); int stat = FindExecutable(fileName, filePath, res); switch (stat) { case FILENOASSOCIATED: throw new Exception("File Not Associated"); case FILENOTFOUND: throw new Exception("FileNot Found"); case PATHNOTFOUND: throw new Exception("Path not Found"); case BADFORMAT: throw new Exception("Bad Format"); default: if (stat >= SUCCESS) return res.ToString(); else throw new Exception("Unknown Error"); } } }
good luck
-
as I know it can be retrieved with shell32 FindExecutable API but sometimes the results is not like what is Expected Maybe this going to help
class Shell32Utils { const int FILENOASSOCIATED = 31; const int FILENOTFOUND = 2; const int PATHNOTFOUND = 3; const int SUCCESS = 32; //and longer const int BADFORMAT = 11; [DllImport("shell32", EntryPoint = "FindExecutable")] static extern int FindExecutable(string file, string directory, [MarshalAs(UnmanagedType.LPStr)] StringBuilder result); public static string Find(string file) { string fileName=System.IO.Path.GetFileName(file); string filePath = System.IO.Path.GetDirectoryName(file)+"\\"; System.Text.StringBuilder res = new StringBuilder(1024); int stat = FindExecutable(fileName, filePath, res); switch (stat) { case FILENOASSOCIATED: throw new Exception("File Not Associated"); case FILENOTFOUND: throw new Exception("FileNot Found"); case PATHNOTFOUND: throw new Exception("Path not Found"); case BADFORMAT: throw new Exception("Bad Format"); default: if (stat >= SUCCESS) return res.ToString(); else throw new Exception("Unknown Error"); } } }
good luck