views:

129

answers:

6

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

+1  A: 

Hi there.

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:

Cheers. Jas.

Jason Evans
But if user has specified another installation path?
Regfor
+2  A: 

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.

RC
+1 for the API.
Nayan
A: 

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.

rerun
A: 

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.

Saravanan
A: 

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

Moderator71
I need it for visio plugin deployment. So visio is not running, but could be launched. I need to notify user when he installs inappropriate version of plugin
Regfor
What programming language are you using?
Moderator71
A: 

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.

Jon Fournier