Kbase 16603: How To Get The Windows Version You Are Running (Version 8.2)
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/05/1998 |
|
How To Get The Windows Version You Are Running (Version 8.2)
The following code sample can only be used in Progress Version 8.2
and higher. It relies on functionality which does not exist in
previous versions.
What the following code does is to read two values from the system
registry, determine which one is not an unknown value and return it
as the result of the function call.
This code has been tested on Windows 95 and Windows NT 4.0 and does
return the correct version information on both platforms. It returns
'4.00.950' on Windows 95 and '4.0' on Windows NT 4.0.
FUNCTION WindowsVersion RETURNS CHARACTER ().
DEFINE VARIABLE WinVer AS CHARACTER NO-UNDO EXTENT 2.
LOAD "SOFTWARE" BASE-KEY "HKEY_LOCAL_MACHINE".
USE "SOFTWARE".
GET-KEY-VALUE SECTION "Microsoft\Windows NT\CurrentVersion"
KEY "CurrentVersion"
VALUE WinVer[1].
GET-KEY-VALUE SECTION "Microsoft\Windows\CurrentVersion"
KEY "VersionNumber"
VALUE WinVer[2].
UNLOAD "SOFTWARE".
RETURN (IF WinVer[1] NE ? THEN WinVer[1] ELSE WinVer[2]).
END FUNCTION.
/* To test the function, run the following code. */
MESSAGE WindowsVersion() VIEW-AS ALERT-BOX.
Progress Software Technical Support Note # 16603