如何以编程方式检测安装的 32 位或 64 位 visio 版本?
如何以编程方式检测安装的 32 位或 64 位 visio 版本?
How to programmatically detect 32-bit or 64-bit visio version is installed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
您可以检查它是否安装在
Program Files (x86)
(32 位)或Program Files
(64 位)中,但这并不是绝对可靠的。GetBinaryType API 可能是一个更可靠的解决方案。
You can check if it's installed in
Program Files (x86)
(32 bits) orProgram Files
(64 bits), but that's not rock solid.The GetBinaryType API is probably a more solid solution.
一种方法是在 Windows 注册表中查看 Office 节点下是否存在 visio (HKLM\Software\Wow6432Node\Microsoft\Office...) 如果存在,则表明 Visio 为 32 位版本。如果 HKLM\Software\Microsoft\Office... 查找返回值,则它可能指示 visio 安装的 64 位版本。希望这有帮助。
One of the ways would be to look in the windows registry to see if visio exists under Office node(HKLM\Software\Wow6432Node\Microsoft\Office...) If exists, it indicates 32 bit version of Visio. If HKLM\Software\Microsoft\Office... lookup returns value, then it possibly indicates 64 bit version of visio installation. Hope this helps.
您可以使用以下任一方法搜索 Visio
EXE
文件:Environment.SpecialFolder.ProgramFiles
Environment.SpecialFolder.ProgramFilesX86
如果您找到 Visio
EXE
文件在X86程序文件文件夹中,那么你就知道它是32位的。另一个文件夹用于 64 位应用程序。但我不确定这有多安全,因为 Visio 可能安装在
Program Files
之外的其他文件夹中。在这种情况下,您仍然可以搜索EXE
文件,然后尝试分析EXE
本身。为此,请查看以下链接:
You could search for the Visio
EXE
file by using either:Environment.SpecialFolder.ProgramFiles
Environment.SpecialFolder.ProgramFilesX86
If you find the Visio
EXE
file in the X86 program files folder, then you know it's a 32-bit. The other folder is for 64-bit applications.I'm not sure how fullproof this is though, since Visio could have been installed in a different folder other the
Program Files
. In that case, you can still search for theEXE
file and then try to analyse theEXE
itself.For that, check out these links:
这就是答案。 Office在 Outlook 项下添加一个有关位数的注册表项(即使未安装 Outlook):
它也位于
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\15.0\Outlook
下(办公室 2013)。This has the answer. Office adds a registry entry for bitness under the Outlook key (even if Outlook is not installed):
It also is there for me under
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\15.0\Outlook
(Office 2013).看看这个问题。使用添加、删除注册表项中存储的有关程序的信息找到 exe 后,评估该 exe。
Take a look at this question. After you find the exe using information stored about the program in add remove registry entires evaluate the exe.
您能否详细说明一下何时需要确定 VISIO 是 64 位还是 32 位?
如果进程正在运行,您可以使用名为 IsWow64Process 的 P/Invoke 方法来确定它是否是 64 位。
您还可以使用 IsWow64Process 来确定操作系统是 32 位还是 64 位。获取操作系统的位空间后,您就可以确定要安装的加载项版本。
据我了解,Office 2010 及未来版本,您可以使用 VSTO 来避免检查 VISIO 是 32 位还是 64 位。您可能需要在加载项的未来版本中考虑这一点。
谢谢
另外,我知道这是不相关的,但请投票支持这个建议(如果你有时间),因为它将彻底改变软件开发:
https://connect.microsoft.com/VisualStudio /feedback/details/526951/screen-object-physicalwidthincentimeters-physicalheightincentimeters-displaymode
Can you elaborate a little more on when you need to determine VISIO is 64 or 32 bit?
If the process is running, you can use a P/Invoke method called IsWow64Process to determine if it is 64 bit or not.
You may also use IsWow64Process to determine if the OS is 32 or 64 bit. Once obtaining the bit space of the OS, then you can determine which version of your add-in to install.
From my understanding, Office 2010 and future releases, you can use VSTO to avoid checking if VISIO is 32-bit or 64-bit. You may want to consider that for future releases of your add-in.
Thanks
Also, I know this is unrelated, but please vote for this suggestion (if you have time) as it would revolutionize software development:
https://connect.microsoft.com/VisualStudio/feedback/details/526951/screen-object-physicalwidthincentimeters-physicalheightincentimeters-displaymode
尝试 Application.IsVisio32 属性
我认为它是 16 位和 32 位版本的 Visio 之间存在区别时遗留下来的,但 IsVisio32 仍然存在(至少在 Visio 2003 32 位和 Visio2010 32 位中)
。没有 IsVisio64 属性,但如果可以的话,看看 IsVisio32 在 64 位安装上会带来什么。
Try the Application.IsVisio32 property
I think it's left over from when there was a distinction between the 16 and 32 bit versions of Visio, but the IsVisio32 is still there (at least in Visio 2003 32-bit, and Visio2010 32-bit.
There is no IsVisio64 property, but see what IsVisio32 comes out with on a 64 bit install, if you can.
这是您工作的另一种方式:
您可以了解 MS Visio 的版本和路径。此主题的链接:https://stackoverflow.com/q/1085468/616309
使用您的
GetMachineType(string fileName)
中的 MS Visio 程序路径。此主题的链接:https://stackoverflow.com/q/885481/616309That's an other way for your work:
You can learn version and path of MS Visio. Link for this subject: https://stackoverflow.com/q/1085468/616309
Use your MS Visio program path in
GetMachineType(string fileName)
. Link for this subject: https://stackoverflow.com/q/885481/616309