是否有标准方法允许用户选择文本查看器?
在我的 Windows 桌面程序中,我希望能够允许用户选择我的程序将使用的文本查看器。
默认情况下,我会将其设置为他用来查看 .TXT 文件的程序,并且我可以从注册表中轻松找到该程序。但他可能想改用记事本或写字板或其他一些程序(例如UltraEdit)。
这是我为对话框想出的内容:
(来源:beholdgenealogy.com)
实际上我有一个这里有两个问题:
是否有推荐的用户界面(即我应该使用某种对话框)?
是否有一种简单的方法可以在用户输入可执行程序后检查它是否确实能够查看文本?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
大多数应用程序只是向您提供一个打开的文件对话框,尽管这看起来有点粗糙。您可以使用本文提供列表来查询窗口获取文件关联列表。还提供使用文件对话框选择程序的功能。
不,没有办法检查新的 exe 是否可以处理 txt 文件。一旦您将文件交给该流程,您就只能希望它能正常工作。
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.