How can I tell programaticly what OS is running
-
How can I find out what OS my program is running under. I need to be able to distinguish between NT 4.0 and Win 2K. Regards, SAK
you can use GetVersionEx OSVERSIONINFO.dwMajorVersion will be 4 for NT 4.0 and 5 for Win 2K Nish
-
How can I find out what OS my program is running under. I need to be able to distinguish between NT 4.0 and Win 2K. Regards, SAK
Try this link. :-D Michael Martin Pegasystems Pty Ltd Australia martm@pegasystems.com +61 413-004-018 "Don't belong. Never join. Think for yourself. Peace" - Victor Stone
-
How can I find out what OS my program is running under. I need to be able to distinguish between NT 4.0 and Win 2K. Regards, SAK
enum OS_TYPE{ OS_WIN_32s, OS_WIN_NT3, OS_WIN_95, OS_WIN_98, OS_WIN_ME, OS_WIN_NT4, OS_WIN_2000, OS_WIN_XP }; unsigned int GetOSType() { OS_TYPE ShellType; DWORD winVer; OSVERSIONINFO *osvi; winVer=GetVersion(); if(winVer<0x80000000){/*NT */ ShellType=OS_WIN_NT3; osvi= (OSVERSIONINFO *)malloc(sizeof(OSVERSIONINFO)); if (osvi!=NULL){ memset(osvi,0,sizeof(OSVERSIONINFO)); osvi->dwOSVersionInfoSize=sizeof(OSVERSIONINFO); GetVersionEx(osvi); if(osvi->dwMajorVersion==4L)ShellType=OS_WIN_NT4; else if(osvi->dwMajorVersion==5L&&osvi->dwMinorVersion==0L)ShellType=OS_WIN_2000; else if(osvi->dwMajorVersion==5L&&osvi->dwMinorVersion==1L)ShellType=OS_WIN_XP; free(osvi); } } else if (LOBYTE(LOWORD(winVer))<4) ShellType=OS_WIN_32s; else{ ShellType=OS_WIN_95; osvi= (OSVERSIONINFO *)malloc(sizeof(OSVERSIONINFO)); if (osvi!=NULL){ memset(osvi,0,sizeof(OSVERSIONINFO)); osvi->dwOSVersionInfoSize=sizeof(OSVERSIONINFO); GetVersionEx(osvi); if(osvi->dwMajorVersion==4L&&osvi->dwMinorVersion==10L)ShellType=OS_WIN_98; else if(osvi->dwMajorVersion==4L&&osvi->dwMinorVersion==90L)ShellType=OS_WIN_ME; free(osvi); } } return ShellType; } //rate me or hate me I am the mighty keeper of the book on knowledge . Contact me to get your copy .