为什么我不能运行从WPF的截图工具?

编程入门 行业动态 更新时间:2024-10-22 02:59:13
本文介绍了为什么我不能运行从WPF的截图工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我创建了一个WPF窗口中出现了很多按钮,他们每个人运行不同的程序。为了运行微软的Word,比如说,我用的:

I've created a WPF Window with a lot of buttons, each of them run a different program. To run MS Word, for instance, I used:

System.Diagnostics.Process.Start("C:\\Program Files (x86)\\Microsoft Office\\Office14\\WINWORD.EXE");

但是,当我尝试运行Windows 7的截图工具同样的方式就行不通。它应该是这样的:

But when I try to run the Windows 7 Snipping Tool the same way it doesn't work. It was supposed to be like this:

System.Diagnostics.Process.Start("C:\\Windows\\System32\\SnippingTool.exe");

我敢肯定的路径是正确的,但总是出现一则消息说,该文件未找到。我想知道为什么会这样。

I'm sure the path is correct, but always appears a message saying the file wasn't found. I would like to know why is this happening.

重要提示:我使用的是Windows 7 64位

Important: I use Windows 7 64 bits.

推荐答案

使用这样的:

// if the build platform of this app is x86 use C:\windows\sysnative if(!Environment.Is64BitProcess) System.Diagnostics.Process.Start("C:\\Windows\\sysnative\\SnippingTool.exe"); else System.Diagnostics.Process.Start("C:\\Windows\\system32\\SnippingTool.exe");

问题是在构建平台(86)和文件夹 C:\Windows\System32\ 64位OS'es

The problem is in your build platform (x86) and the automatic redirection of the folder C:\Windows\System32\ on 64-bit OS'es.

基本上,有几个原因,在Vista / Windows 7的64位OS'es当32位应用程序试图访问 C:\Windows\System32\ 将被自动重定向到名为文件夹 C:\Windows\SysWOW64\ 。因此,你不能启动 snippingtool.exe ,因为它不存在的文件夹中。

Basically, for several reasons, in vista/windows 7 64-bit OS'es when a 32 bit application try to access to C:\Windows\System32\ it is automatically redirected to the folder called C:\Windows\SysWOW64\. Hence, you cannot start snippingtool.exe because it is not present in that folder.

的唯一方法是使用 C:\Windows\sysnative\ 并绕过重定向

The only way is to use C:\Windows\sysnative\ and bypass the redirection.

更多推荐

为什么我不能运行从WPF的截图工具?

本文发布于:2023-11-17 01:59:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1608390.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:截图   工具   WPF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!