Search code examples
c++windows32bit-64bit

Detect 32-bit or 64-bit of Windows


I want to detect whether the current Windows OS is 32-bit or 64-bit. How to achieve it using C++? I don't want processor type I want OS's bit type. This is because you can install 32-bit OS on 64-bit processor.


Solution

  • The function to call is IsWow64Process or IsWow64Process2. It tells your 32-bit application if it is running on a 64 bit Windows.

    If the program is compiled for 64 bits, it will already know.