10-11-2011، 11:55 PM
با سورس زیر متیونید نوع سیستم عامل رو شناسایی کنید.
کد:
void GetOS(char theos[256])
{
OSVERSIONINFO OS;
OS.dwOSVersionInfoSize = sizeof(OS);
GetVersionEx(&OS);
switch (OS.dwPlatformId)
{
case 0:
strcpy(theos,"Win3.1");
break;
case 1:
switch (OS.dwMinorVersion)
{
case 0:
strcpy(theos,"Win95");
break;
case 10:
strcpy(theos,"Win98");
break;
case 98:
strcpy(theos,"WinMe");
break;
}
break;
case 2:
switch (OS.dwMajorVersion)
{
case 3:
strcpy(theos,"WinNT");
break;
case 4:
strcpy(theos,"WinNT");
break;
case 5:
switch (OS.dwMinorVersion)
{
case 0:
strcpy(theos,"Win2000");
break;
case 1:
strcpy(theos,"WinXP");
break;
}
break;
case 6:
switch (OS.dwMinorVersion)
{
case 0:
strcpy(theos,"Vista");
break;
case 1:
strcpy(theos,"Win7");
break;
}
break;
}
break;
}