BOOL Is64BitWindows() { #if defined(_WIN64) return TRUE; // 64-bit programs run only on Win64 #elif defined(_WIN32) // 32-bit programs run on both 32-bit and 64-bit Windows // so must sniff BOOL f64 = FALSE; return IsWow64Process(GetCurrentProcess(), &f64) && f64; #else return FALSE; // Win64 does not support Win16 #endif }
{
#if defined(_WIN64)
return TRUE; // 64-bit programs run only on Win64
#elif defined(_WIN32)
// 32-bit programs run on both 32-bit and 64-bit Windows
// so must sniff
BOOL f64 = FALSE;
return IsWow64Process(GetCurrentProcess(), &f64) && f64;
#else
return FALSE; // Win64 does not support Win16
#endif
}
void** p = 0;
if(sizeof(p) == 4) // 32位
else if(sizeof(p) == 8) // 64位
C#可以用
if (IntPtr.Size == 8)
{
// 64bit
}
64位系统也能运行32位程序,你这个只能判断当前进程是否为64位。
google 第一帖竟然这么水