Detection of current version 'Windows' Operating system using Studio 5 -- sys(7) alternative

Doug Easterbrook doug at artsman.com
Mon Nov 5 21:20:25 EST 2018


hi paul —

my code is similar —and based off sys (7);    This is the mac part.

itrs not 100% accurate, but close.


what I really need is to know 100% for sure that the machine I’m running on is windows8, windows 8.1 or windows 10  — using some function in studio 5.   and sys(7) does not work for the higher operating system versions on windows.

I was hoping somebody had  done something with register dll/call dll     or had a way to get a result out of a system call - or reading theregistry.

eg, I’ve seen that this could work
CString osname = GetStringFromReg(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", L"ProductName”);

or this command in dos
systeminfo | findstr /B /C:"OS Name" /C:"OS Version"



I”m not adept at getting the registerdll thing — so if somebody has done it… it would be great. 





Calculate versionString as sys(7)
Calculate versionWIN as $ctask.$convertVersion(versionString)
If isvista()
If versionWIN<6.0069900
Calculate OS as 'Vista/2008R1'
Else If versionWIN<6.2000
Calculate OS as 'Windows 7/2008R2'
Else If versionWIN<=6.2999
Calculate OS as 'Windows 8'
Else If versionWIN<=6.39200
Calculate OS as 'Windows 8.1/Server 2012'
Else If versionWIN<=6.396
Calculate OS as 'Windows 8.1R1/Server 2012R2'
Else If versionWIN<=10.0200
Calculate OS as 'Windows 10/Server 2016'
Else
Calculate OS as 'beyond Windows 10/Server 2016'
End If
Else If versionWIN<=4.9
Calculate OS as 'Windows 95/Windows 98'
Else If versionWIN<=5.1
Calculate OS as '2003 Server/XP Pro'
Else
Calculate OS as con('Windows V',sys(7))
End If
end if



Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at artsman.com
http://www.artsman.com
Phone (403) 650-1978

> On Nov 5, 2018, at 4:57 PM, Paul Mulroney <pmulroney at logicaldevelopments.com.au> wrote:
> 
> Hi Doug,
> 
> Here's the bit of code we use for Studio 5:
> 
> ;  - Display platform details in a meaningful fashion
> Calculate vsPlatform as pick(pos(sys(6),'WNMXU'),'','Win98','Win32','Mac OS9','Mac OSX','Linux')
> If islion()     ;; Put the most recent Mac OS first
> 	Calculate vsOS as '10.7 (Lion)'
> Else If issnowleopard()
> 	Calculate vsOS as '10.6 (Snow Leopard)'
> Else If isleopard()
> 	Calculate vsOS as '10.5 (Leopard)'
> 
> Else If iswindows7(kFalse)     ;; Put the most recent Windows OS first
> 	If iswindows7(kTrue)     ;; Themed
> 		Calculate vsOS as 'Windows 7 (Themed)'
> 	Else
> 		Calculate vsOS as 'Windows 7'
> 	End If
> Else If isvista(kFalse)
> 	If isvista(kTrue)     ;; Themed
> 		Calculate vsOS as 'Windows Vista (Themed)'
> 	Else
> 		Calculate vsOS as 'Windows Vista'
> 	End If
> Else If sys(6)='N'&sys(197)=kTrue     ;; Windows XP with themes enabled.
> 
> Else     ;; Not any of the above, probably no further information available
> 	Calculate vsOS as 'No further details'
> End If
> 
> 
> For Studio 8, there's a few more options, but some of this will probably still work for Studio 5:
> 
> ;  --- Get the windows version details
> Calculate vsOS as sys(7)
> Calculate vnPartOne as strtok('vsOS','.')
> Calculate vnPartTwo as strtok('vsOS','.')
> 
> ;  -- Check Windows Server
> If iswindowsserver()
> 	If vnPartOne=10     ;; Server NT 10.x
> 		If vnPartTwo=0     ;; Win Server 2016 -> Server NT 10.0
> 			Calculate psOS as 'Windows Server 2016'
> 		Else
> 			Calculate psOS as con('Windows Server NT ',vnPartOne,'.',vnPartTwo)
> 		End If
> 		
> 	Else If vnPartOne=6     ;; Server NT 6.x
> 		If vnPartTwo=3     ;; Win Server 2012 R2 -> Server NT 6.3
> 			Calculate psOS as 'Windows Server 2012 R2'
> 		Else If vnPartTwo=2     ;; Win Server 2012 -> Server NT 6.2
> 			Calculate psOS as 'Windows Server 2012'
> 		Else If vnPartTwo=1     ;; Win Server 2008 R2 -> Server NT 6.1
> 			Calculate psOS as 'Windows Server 2008 R2'
> 		Else If vnPartTwo=0     ;; Win Server 2008 -> Server NT 6.0
> 			Calculate psOS as 'Windows Server 2008'
> 		Else
> 			Calculate psOS as con('Windows Server NT ',vnPartOne,'.',vnPartTwo)
> 		End If
> 		
> 	Else If vnPartOne=5     ;; Server NT 5.x
> 		If vnPartTwo=2     ;; Win Server 2003 -> Server NT 5.2
> 			Calculate psOS as 'Windows Server 2003'
> 		Else If vnPartTwo=1     ;; Doesn't exist
> 			Calculate psOS as con('Windows Server NT ',vnPartOne,'.',vnPartTwo)
> 		Else If vnPartTwo=0     ;; Win Server 2000 -> Server NT 5.0
> 			Calculate psOS as 'Windows Server 2000'
> 		Else
> 			Calculate psOS as con('Windows Server NT ',vnPartOne,'.',vnPartTwo)
> 		End If
> 		
> 	Else
> 		Calculate psOS as con('Windows Server NT ',vnPartOne,'.',vnPartTwo)
> 	End If
> 	
> Else     ;; PC Versions
> 	
> 	;  -- Guess from the version number first
> 	If vnPartOne=10     ;; NT 10.x
> 		If iswindows10(kFalse)|vnPartTwo=0     ;; Win 10 -> NT 10.0
> 			Calculate psOS as pick(iswindows10(kTrue),'Windows 10','Windows 10 (Themed)')
> 		Else
> 			Calculate psOS as con('Windows NT ',vnPartOne,'.',vnPartTwo)
> 		End If
> 		
> 	Else If vnPartOne=6     ;; NT 6.x
> 		If iswindows81(kFalse)|vnPartTwo=3     ;; Win 8.1 -> NT 6.3
> 			Calculate psOS as pick(iswindows81(kTrue),'Windows 8.1','Windows 8.1 (Themed)')
> 		Else If iswindows8(kFalse)|vnPartTwo=2     ;; Win 8 -> NT 6.2
> 			Calculate psOS as pick(iswindows8(kTrue),'Windows 8','Windows 8 (Themed)')
> 		Else If iswindows7(kFalse)|vnPartTwo=1     ;; Win 7 -> NT 6.1
> 			Calculate psOS as pick(iswindows7(kTrue),'Windows 7','Windows 7 (Themed)')
> 		Else If isvista(kFalse)|vnPartTwo=0     ;; Win Vista -> NT 6.0
> 			Calculate psOS as pick(isvista(kTrue),'Windows Vista','Windows Vista (Themed)')
> 		Else
> 			Calculate psOS as con('Windows NT ',vnPartOne,'.',vnPartTwo)
> 		End If
> 		
> 	Else If vnPartOne=5     ;; NT 5.x
> 		Switch vnPartTwo
> 			Case 0     ;; Win 2000 -> NT 5.0
> 				Calculate psOS as 'Windows 2000'
> 			Case 1     ;; Win XP -> NT 5.1
> 				Calculate psOS as 'Windows XP'
> 			Case 2     ;; XP Professional -> NT 5.2
> 				Calculate psOS as 'Windows XP Professional x64'
> 			Default
> 				Calculate psOS as con('Windows NT ',vnPartOne,'.',vnPartTwo)
> 		End Switch
> 		
> 		;  -- Then use Omnis' functions
> 	Else If iswindows10(kFalse)     ;; Win 10 - Put the most recent Windows OS first
> 		Calculate psOS as pick(iswindows10(kTrue),'Windows 10','Windows 10 (Themed)')
> 		
> 	Else If iswindows81(kFalse)     ;; Win 8.1
> 		Calculate psOS as pick(iswindows81(kTrue),'Windows 8.1','Windows 8.1 (Themed)')
> 		
> 	Else If iswindows8(kFalse)     ;; Win 8
> 		Calculate psOS as pick(iswindows8(kTrue),'Windows 8','Windows 8 (Themed)')
> 		
> 	Else If iswindows7(kFalse)     ;; Win 7
> 		Calculate psOS as pick(iswindows7(kTrue),'Windows 7','Windows 7 (Themed)')
> 		
> 	Else If isvista(kFalse)     ;; Win Vista
> 		Calculate psOS as pick(isvista(kTrue),'Windows Vista','Windows Vista (Themed)')
> 		
> 	Else
> 		Calculate psOS as con('Windows NT ',vnPartOne,'.',vnPartTwo)
> 	End If
> End If
> 
> Regards,
> Paul.
> 
>> On 5 Nov 2018, at 10:49 pm, Doug Easterbrook <doug at artsman.com> wrote:
>> 
>> hi all.
>> 
>> I’m finalizing/testing our code to help people get over to 64 bit OS and 64 bit application and I’ve run into an issue with sys(7) on windows.
>> 
>> On mac, sys(7) will tell you the version of the operating system up to the latestMacOS day.   perfect.
>> 
>> 
>> On windows 10, I’f I’m running studio 5.2.3 runtime then  sys(7) still returns 6.2 — telling me that Studio 5.2.3 thinks this is a windows 8 machine.
>> 
>> 
>> does anybody have any code trick handy that will tell me what the current version of the windows operating system is (using studio 5)???   
>> 
>> 
>> all I really want to know is Windows 8 and before or Window 8.1 and later .. but it would be nice if I could get the exact version.
>> 
>> 
>> 
>> 
>> 
>> Studio 8, other other hand … tells me nicely, but I need to know in studio 5 to suggest to get to studio 8.
>> 
>> 
>> 
>> 
>> Doug Easterbrook
>> Arts Management Systems Ltd.
>> mailto:doug at artsman.com
>> http://www.artsman.com
>> Phone (403) 650-1978
>> 
>> _____________________________________________________________
>> Manage your list subscriptions at http://lists.omnis-dev.com
>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 
> 
> 
> "A user interface is well-designed when the program behaves exactly how the user thought it would."
> Joel on Software
> -- 
> Paul W. Mulroney                           We Don't Do Simple Pty Ltd 
> pmulroney at logicaldevelopments.com.au       Trading as Logical Developments
> www.logicaldevelopments.com.au             ACN 161 009 374 
> Ph: +61 8 9458 3889                        86 Coolgardie Street
>                                           BENTLEY  WA  6102
> 
> 
> 
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 




More information about the omnisdev-en mailing list