简体   繁体   中英

How to programmatically detect 32-bit or 64-bit visio version is installed?

如何以编程方式检测32位或64位visio版本?

You can check if it's installed in Program Files (x86) (32 bits) or Program Files (64 bits), but that's not rock solid.

The GetBinaryType API is probably a more solid solution.

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 the EXE file and then try to analyse the EXE itself.

For that, check out these links:

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.

This has the answer. Office adds a registry entry for bitness under the Outlook key (even if Outlook is not installed):

  • Registry path: HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Office\\14.0\\Outlook
  • Registry key: Bitness
  • Value: either x86 or x64

It also is there for me under HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Office\\15.0\\Outlook (Office 2013).

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.

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM