how to retrive the excutions file of a MimeType?
-
HI, In My application I need to retrive the excution file for a given mimetype. i.e. I have "Smaple.doc" So I retrive it's MimeType by "doc" extention and now I'm missing the way to retrive the actual excution file of the mimeType (in this example it should be "winword.exe". Any ideas on how to do so? it doesn't have to be the same way I'm thinking of doing it, as long as the in string is a given file name ("xxx.doc") and out is the excution file ("winword.exe"). tnx
modified on Saturday, December 13, 2008 6:19 AM
-
HI, In My application I need to retrive the excution file for a given mimetype. i.e. I have "Smaple.doc" So I retrive it's MimeType by "doc" extention and now I'm missing the way to retrive the actual excution file of the mimeType (in this example it should be "winword.exe". Any ideas on how to do so? it doesn't have to be the same way I'm thinking of doing it, as long as the in string is a given file name ("xxx.doc") and out is the excution file ("winword.exe"). tnx
modified on Saturday, December 13, 2008 6:19 AM
Are you sure you need to know the exe? if you execute
Process.Start("xxx.doc")
it will launch whatever exe is associated with the .doc extension (probably winword.exe), as if you double-clicked the file in Windows Explorer. :)Luc Pattyn [Forum Guidelines] [My Articles]
Fixturized forever. :confused:
-
HI, In My application I need to retrive the excution file for a given mimetype. i.e. I have "Smaple.doc" So I retrive it's MimeType by "doc" extention and now I'm missing the way to retrive the actual excution file of the mimeType (in this example it should be "winword.exe". Any ideas on how to do so? it doesn't have to be the same way I'm thinking of doing it, as long as the in string is a given file name ("xxx.doc") and out is the excution file ("winword.exe"). tnx
modified on Saturday, December 13, 2008 6:19 AM
Hello, As Luc has told you if the only thing you need is to launch the application associated with doc file, you can use Process class. On the other hand if you really need to retrieve application path then you will need to use various methods for reading windows registry as the information is stored in system registry.
Giorgi Dalakishvili #region signature My Articles Asynchronous Registry Notification Using Strongly-typed WMI Classes in .NET [^] My blog #endregion
-
Hello, As Luc has told you if the only thing you need is to launch the application associated with doc file, you can use Process class. On the other hand if you really need to retrieve application path then you will need to use various methods for reading windows registry as the information is stored in system registry.
Giorgi Dalakishvili #region signature My Articles Asynchronous Registry Notification Using Strongly-typed WMI Classes in .NET [^] My blog #endregion
Anyhow I found the answer my self already. It's all in the registry. in order to retrive which application is associated with the extention you need to access the OpenWithList key for the extention. all the extentions are located under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts there you can find your extention and all you need is to open the OpenWithList key i.e. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.doc\OpenWithList in this key you will find DWORD's a,b,c each represent and application to use in order to open this file. "a" is the default.