Page 1 of 1

Reliable OS version detecting

Posted: Fri Dec 13, 2013 8:14 pm
by codemaker
I need to precise detect the OS on which my app is running. The reason is complicated but basically I have a DLL which creates and manages the PDF files. This DLL works perfect on all Windows OS, except on Windows Server 2012 (Don't know about future Windows versions)
Works on all versions from XP to Windows 7, Windows 8, Windows Servers 2003, 2008.
Only Windows Server 2012 hangs the program when trying to access that DLL functions.

I need to detect the Windows Server 2012 OS and avoid calling this DLL and do some other PDF management is such case.

I was also thinking if there is some very specific file somewhere in Windows folder, which is solely related to Windows Server 2012 OS, maybe I can detect such file and then know that the machine runs Windows Server 2012?

Thanks

Re: Reliable OS version detecting

Posted: Fri Dec 13, 2013 9:15 pm
by ADutheil
I don´t know if its available under Windows Server 2012 but most Windows version I ran had the ver command that returns the current version. It can be redirected to file and easily treated.

Re: Reliable OS version detecting

Posted: Sun Dec 15, 2013 12:29 am
by codemaker
Yes, I was thinking about that but cannot confirm the reliability of the numbers yielded in VER command.
In any case, I solved the problem in different way. After I confirm the OS, I have a small file on some folder if the OS is 2012, which I check and according to that, decide to use the library or not.

Re: Reliable OS version detecting

Posted: Sun Dec 15, 2013 11:06 am
by cnavarro
Have you tried the function?

Code: Select all

? "Version S.O.: "+ Os()