VC OS 정보 얻기

1978 단어
1. 시스템 버전 가져오기
 
	int a=0,b=0,i=0,j=0;
	_asm
	{
		pushad
			mov ebx,fs:[0x18] ; get self pointer from TEB
			mov eax,fs:[0x30] ; get pointer to PEB / database
			mov ebx,[eax+0A8h] ; get OSMinorVersion
			mov eax,[eax+0A4h] ; get OSMajorVersion
			mov j,ebx
			mov i,eax
			popad
	}

	if((i==5)&&(j==0))
	{
		AfxMessageBox(_T("      Windows 2000"),MB_OK);
	}
	else if((i==5)&&(j==1))
	{ 
		AfxMessageBox(_T("      Windows XP"),MB_OK);
	}
	else if((i==5)&&(j==2))

	{
		AfxMessageBox(_T("      Windows 2003"),MB_OK);
	}
	else if((i==6)&&(j==0))
	{
		AfxMessageBox(_T("      Windows Vista"),MB_OK);
	}
	else if((i==6)&&(j==1))
	{
		AfxMessageBox(_T("      Win7"),MB_OK);
	}

2, 운영 체제 비트 가져오기
 
	SYSTEM_INFO lpsysinfo;	
	typedef VOID(WINAPI *LPFN_GetNativeSysteminfo)(LPSYSTEM_INFO lpsysteminfo);	
	LPFN_GetNativeSysteminfo fGetinfo = (LPFN_GetNativeSysteminfo)GetProcAddress(GetModuleHandle("Kernel32.dll"),"GetNativeSystemInfo");
	fGetinfo(&lpsysinfo);	
	if(lpsysinfo.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 || lpsysinfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)
	{		
		AfxMessageBox("64   ");		
	}	
	else		
	{		
		AfxMessageBox("32   ");		
	}

3. 시스템 언어 가져오기
 
	LCID language;
	language=GetSystemDefaultLCID();
	CString sysLan;
	switch(language)
	{
	case 2052:
		sysLan = "  (  ) ";
		break;
	case 3076:
		sysLan = "  (  ) ";
		break;
	case 1028:
		sysLan = "  (  ) ";
		break;
	case 1033:
		sysLan = "  (  ) ";
	case 1041:
		sysLan = "        ";
		//  format  .....
		break;
	default:
		sysLan = "   ";
		break;
	}
	AfxMessageBox(sysLan);

 
 
기타
자세한 내용은 msdn:http://msdn.microsoft.com/en-us/library/windows/desktop/ms724429(v=vs.85).aspx

좋은 웹페이지 즐겨찾기