Detect 32-bit or 64-bit of Windows

Solution 1:

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.

Solution 2:

If your code is 64-bit and running, then Windows is 64-bit - nothing to check. If your process is 32-bit call IsWow64Process() - 32-bit processes run in WOW64 on 64-bit Windows and without WOW64 otherwise.