Okay, I have an app that must take a filename and launch it with it's associated program. In other words, if the file is a word doc then it should open in MS-Word. If the file is an mp3, it should open and play in whichever player the user has designated. IF a program is associated with the file extension, that program should be launched with the file loaded.
Now, is there a way to do this?
Loading
Jan MontanoPosted Feb 3, 2009, 11:31 PM
doc extensions
HKEY_CLASSES_ROOT\.doc\(Default)
pdf extensions
HKEY_CLASSES_ROOT\.pdf\(Default)
If you can't find the specific key for your file extension, then I guess windows doesn't have an association for it.
Matthew GivensPosted Feb 3, 2009, 4:41 PM
Okay, nevermind the original question, I figured it out. It was quite simple, actually.
That seems to work fine, and raises an exception if the file extension has no associated program. I can trap that exception well enough, but it would be nice to know in advance if the computer has a program set to handle that type of file. So, is there a method I can use to pass in a file name and determine if it has an associated program? Or is trapping the exception the simplest way?