【VC】 判断windows系统是64位还是32位

修改:这个函数的作用应该是判断当前进程是否为32位应用程序运行在64位机器上

修改日期:2014年7月19日 21:16:51 

 1 #include "stdafx.h"
 2 #include "windows.h"
 3 #include <iostream>
 4 using namespace std;
 5 
 6 BOOL IsWow64() 
 7 { 
 8     typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); 
 9     LPFN_ISWOW64PROCESS fnIsWow64Process; 
10     BOOL bIsWow64 = FALSE; 
11     fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress( GetModuleHandle(_T("kernel32")),"IsWow64Process"); 
12     if (NULL != fnIsWow64Process) 
13     { 
14         fnIsWow64Process(GetCurrentProcess(),&bIsWow64);
15     } 
16     return bIsWow64; 
17 } 
18 
19 
20 
21 int _tmain(int argc, _TCHAR* argv[])
22 {
23     if (TRUE == IsWow64())
24     {
25         cout<<"64位"<<endl;
26     }
27     else
28     {
29         cout<<"32位"<<endl;
30     }
31     return 0;
32 }


原文地址:https://www.cnblogs.com/cuish/p/3006294.html