// Get the version number of both Windows and DOS
// For some reason, Windows for Workgroups 3.11
//    still comes up as 3.10.

// Windows API function call
declare pfunc GetVersion returning long in dll kernel.exe

lRetVal = GetVersion()

// nWinMajor is the LOBYTE of the LOWORD
nWinMajor = int(lRetVal % 256)
// nWinMinor is the HIBYTE of the LOWORD
nWinMinor = int((lRetVal / 256) % 256)
// nDOSMajor is the HIBYTE of the HIWORD
nDOSMajor = int(((lRetVal / 65536) / 256) % 256)
// nDOSMinor is the LOBYTE of the HIWORD
nDOSMinor = int((lRetVal / 65536) % 256)

@ 2,0 say 'Windows version: '+alltrim(str(nWinMajor))+'.'+alltrim(str(nWinMinor))
@ 3,0 say 'DOS version: '+alltrim(str(nDOSMajor))+'.'+alltrim(str(nDOSMinor))

wait
