1. 程式人生 > >IsWow64Process 判斷作業系統位數

IsWow64Process 判斷作業系統位數

判斷作業系統是不是64位

typedef   BOOL   (WINAPI   *LPFN_ISWOW64PROCESS)   (HANDLE,   PBOOL); 
LPFN_ISWOW64PROCESS   
fnIsWow64Process   =   (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle("kernel32"), "IsWow64Process"); 

CString GetSystemIsWow64() 
{ 
	BOOL  bIsWow64   =   FALSE; 
	CString str64;
	if   (NULL   !=   fnIsWow64Process) 
	{ 
		if   (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64)) 
		{
			MessageBox(0,"Handle Error!",0,0);
		} 
	} 
	if (bIsWow64 == true)
	{
		str64 = "64位";
	}
	else
	{
		str64 = "32位";
	}
	return str64;
}