How do get version of windows you are running Uniface on? Windows API?
Author: bhughes444@gmail.com (bhughes)
I am trying to write a bit of code in 9.7.02 to obtain the version of Windows the application is running on (Wnidows 7, XP etc). What is the best approach to do so? I have yet to actually use any windows API's so if this is the correct course to get this information any help in which API, how to import it and what the activate would look like is greatly appreciated! Thanks!
10 Comments
Local Administrator
What about $oprsys? It gives you a nmemonic for the OS used. Values A - OpenVMS Alpha H - Microsoft Windows 98 L - Microsoft Windows NT M - Microsoft Windows 8 N - Microsoft Windows Server 2012 P - Microsoft Windows XP S - Windows Server 2016 U - Unix V - OpenVMS VAX W - Windows 10 Y - Microsoft Windows Vista 2 - Microsoft Windows Server 2000 3 - Microsoft Windows Server 2003 4 - AS/400 7 - Microsoft Windows 7 8 - Microsoft Windows Server 2008
Author: luis.vila (luis.vila@uniface.es)
Local Administrator
Alternatively $setting("","HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName","REGDATA") Gives "Windows 10 Pro" on my machine $setting("","HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentBuild","REGDATA") Gives "14393" If you look at that regkey through regedit you will see that there are a bunch of potentially useful bits in there (install date, registered Owner, RegisteredOrganisation) Iain
Author: Iain Sharp (i.sharp@pcisystems.co.uk)
Local Administrator
I've added below piece of proc code behind a button in a demo app. I think the $about "platform" should work for you. Regards, Arjen ;Detail trigger variables string vVersion string vBuild string vBuildDate string vPlatform endvariables getitem/id vVersion $about "version" getitem/id vBuild $about "config" getitem/id vBuildDate $about "date" getitem/id vPlatform $about "platform" askmess/info "Uniface version: %%vVersion%%% (%%vBuild%%%) %%^Date: %%vBuildDate%%% %%^Platform: %%vPlatform%%%", "OK"
Author: Arjen van Vliet (arjen.van.vliet@uniface.com)
Local Administrator
It works, but need to add the commas to the GetItem/Id statements: (you may have to manually change the double quotes due to WP mods) Variables String sVersion String sBuild String sBuildDate String sPlatform String sTrack EndVariables GetItem/Id sVersion, $About, “Version” GetItem/Id sBuild, $About, “Config” GetItem/Id sBuildDate, $About, “Date” GetItem/Id sPlatform, $About, “Platform” GetItem/Id sTrack, $About, “Track” AskMess/Info “Uniface version: %%sVersion%%% (%%sBuild%%%) %%^ Track: %%sTrack%%% %%^Date: %%sBuildDate%%% %%^Platform: %%sPlatform%%%”, “OK”
Author: RobM (maciokr@natfuel.com)
Local Administrator
Commas somehow got lost during copy and paste of the code on to the forum
Author: Arjen van Vliet (arjen.van.vliet@uniface.com)
Local Administrator
Does this work consistently 'everywhere' Iain?.. I can't recall the details, but we had some challenges with separating a few OS's between server clients, native clients, and somewhere in the mix I think XP caused issues...
Author: Adrian Gosbell (adrian.gosbell@synapse-i.jp)
Local Administrator
Hi There is another alternative asking directly to windows: activate "OS".commandout("cmd /c ver", VC_VER) ;VC_VER = Microsoft Windows [Versión 10.0.10240] activate "OS".commandout("systeminfo /fo CSV /NH", VC_SYS) ;VC_SYS = "LIMBO18","Microsoft Windows 10 Enterprise N 2015 LTSB","10.0.10240 N/D Compilación 10240",... It gives you computer name, OS, memory... and a lot of info. I do not know since when this command exists but I've jus tested in an old server: "hidden","Microsoft(R) Windows(R) Server 2003, Standard Edition","5.2.3790 Service Pack 2 Compilación 3790","Microsoft Corporation",... Just getting second or third item gives you detail enough. Regards
Author: luis.vila (luis.vila@uniface.es)
Local Administrator
Hmmm, our global proc (for reading registry keys) has some sideband stuff to cope with Windows 2008 64 bit where the requested key contains Wow6432Node, but this code is successfully telling us about the following operating systems. Microsoft Windows Server 2003 Microsoft Windows Server 2003 R2 Microsoft Windows XP Windows (R) Small Business Server 2008 Windows 10 Enterprise Windows 10 Home Windows 10 Pro Windows 10 Pro Insider Preview Windows 10 Pro Technical Preview Windows 7 Enterprise Windows 7 Professional Windows 7 Ultimate Windows 8 Pro Windows 8 Pro with Media Center Windows 8.1 Pro Windows Server (R) 2008 Standard Windows Server 2008 R2 Datacenter Windows Server 2008 R2 Standard Windows Server 2012 Essentials Windows Server 2012 Foundation Windows Server 2012 R2 Standard Windows Server 2012 Standard Windows Small Business Server 2011 Standard Windows Vista (TM) Business
Author: Iain Sharp (i.sharp@pcisystems.co.uk)
Local Administrator
I've re-checked this and apparently it can work without the comma's (9.7.03 on my part ). Help file (9.7.03) example is also without comma's: http://unifaceinfo.com/docs/0907/Uniface_Library_HTML/ulibrary/$about_F522F0F55ED9E5E73A55FDF4A839C16D.html
Author: Arjen van Vliet (arjen.van.vliet@uniface.com)
Local Administrator
Thanks Iain, useful info.
Author: Adrian Gosbell (adrian.gosbell@synapse-i.jp)