作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在尝试将 Launcher.LaunchFileAsync()
方法与示例 .txt 文件一起使用,但它不起作用 - 总是为写字板返回 false(这是 Windows 8 上的默认程序显示 .txt 文件)。
但是,如果我将控制面板中的 .txt 处理设置更改为记事本或 Word,一切正常,LaunchFileAsync()
返回 true 并且文件得到正确显示。
知道为什么会这样吗?
最佳答案
如果您只是想运行一个桌面应用程序,例如(记事本、写字板、Internet Explorer 等),请查看 Process Methods 和 ProcessStartInfo 类。
try
{
// Start the child process.
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = "C:\Path\To\App.exe";
p.Start();
}
// Uses the ProcessStartInfo class to start new processes,
// both in a minimized mode.
void OpenWithStartInfo()
{
ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(startInfo);
startInfo.Arguments = "www.northwindtraders.com";
Process.Start(startInfo);
}
关于c# - "Windows.System.Launcher"不启动写字板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14403014/
我是一名优秀的程序员,十分优秀!