Is There A Standard Way To Allow The User To Select A Text Viewer?
-
20-09-2019 - |
Question
In my Windows desktop program, I want to be able to allow the user to select a text viewer that my program will use.
By default, I'll have it set to be the program (s)he uses to view .TXT files, and I can find that easily enough from the Registry. But he may want to change to use Notepad or Wordpad or some other program (e.g. UltraEdit).
This is what I came up with for the dialog box:
(source: beholdgenealogy.com)
Actually I have a two questions here:
Is there a recommended user interface for this (i.e. some sort of dialog I should use)?
Is there a simple way to check, once the user enters a program executable, that it is indeed capable of text viewing?
Solution
Most applications just present you with an open file dialog, although that does seem a bit crude. You could provide a list using this article to query windows for a list of file associations. Also provide a function to pick a programme using a file dialog.
No there isn't a way to check the new exe can handle txt files. Once you hand the file off to that process you just have to hope it works.