How can I find out if a default viewer exist for a file type (PDF for example)? I am planing to use ShellExecute
to open a PDF file that I have downloaded from server, but I need to know if the device is capable of vie开发者_JAVA百科wing the file before I attempt to download it.
P.S. This is a Visual C++ 2008 mobile project.
Thank You Sam
Same as with the desktop. For example, for PDFs you'd look in the registry (with RegOpenKeyEx and its relatives) for an extension association:
[HKEY_CLASSES_ROOT\.pdf]
If that exists, the default value will be the name of another key in HKEY_CLASSES_ROOT
, which you'd open to
[HKEY_CLASSES_ROOT\{class name}\Shell\Open\Command
which would tell you what, exactly, ShellExecute will run.
精彩评论