How do I find out if my application is running on x86 or x64 Windows?

房东的猫 提交于 2019-12-06 00:27:21

If your application is compiled for 64-bit, then the answer's easy: you're running on 64-bit Windows.

If your application is compiled for 32-bit, you need to call IsWow64Process. This function is only exported on Windows XP or later; if you want to support earlier versions of Windows, you'll need to use GetProcAddress to get a pointer to this function.

Assuming you're using C++, there's a very good OS detection class here.

You can get the build number already from the OSVERSIONINFOEX structure.

If you are a 32-bit process and want to know if you're running under WOW64 (ie., a 64-bit OS), call IsWow64Process(). (requires XP SP2 or later)

I use WMI.

select * from Win32_OperatingSystem

Get the first instance, and then select the Version attribute. For WinXP, it returns 5.1.2600.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!