1

Possible Duplicate:
Detect whether current Windows version is 32 bit or 64 bit
Correct way to check if Windows is 64 bit or not, on runtime? (C++)

I found some questions on the topic, but not exactly what I need.

I'm developing a C++/Qt application that is completely cross-platform except for some precompiled .exe's the app has to run. (Only Windows is relevant to the question). I have 32 and 64 bits Windows versions of these executables. I know that one option would be to package two versions of the whole app, but the change in the code would be so minimal that I'd like to think of other alternatives.

So, is there a way to detect at runtime, using C++/Qt features, whether the underlying Windows is a 32 or a 64 bits version?

Thanks!

Community
  • 1
  • 1
Manu Torres
  • 68
  • 2
  • 9

1 Answers1

1

No, but you can call WINAPI functions to tell you this.

Call GetNativeSystemInfo(). If you're running x64, SYSTEM_INFO::wProcessorArchitecture will be PROCESSOR_ARCHITECTURE_AMD64. If 32 x86 bit it will be PROCESSOR_ARCHITECTURE_INTEL

John Dibling
  • 99,718
  • 31
  • 186
  • 324