法1.
environment env integer resp string temp,ls_version resp = getenvironment(env)
choose case env.ostype case aix! temp = ''AIX'' case hpux! temp = ''HPUX'' case macintosh! temp = ''MacIntosh'' case osf1! temp = ''OSF1'' case sol2! temp = ''Solaris 2'' case Windows! temp = ''Windows'' case WindowsNT! temp = ''Windows NT'' end choose ls_version = temp + '' ''+string(env.osmajorrevision)+''.''+string(env.osminorrevision)+''.''+string(env.osfixesrevision)
messagebox("Windows version",ls_version)
每种操作系统都有其版本号,自己在不同的操作系统上运行一下就知道了.然后再转换成自己熟悉的windows名称就可以了
方法2.
Long L1 dec{2} ldc_WinVer string ls_WinVer L1 = GetVersion() ldc_WinVer = MOD(intlow(L1),256) + int(intlow(L1)/256)/100 choose case ldc_WinVer case 3.10 ls_WinVer = "Windows 3.x" case 4 ls_WinVer = "Windows NT 4.0" case 4.10 ls_WinVer = "Windows 98" case 5 ls_WinVer = "Windows 2000" case 5.01 ls_WinVer = "Windows XP" case 5.02 ls_WinVer = "Windows 2003" end choose messagebox("Windows version",ls_WinVer) ---------------------------------------------------------------
下面给出一个函数
// Function: gf_getos()
// Description: Get current Os name
// Arguments: value integer
// Returns: string // 95-98 : Windows // 2000- : WindowsNT // Else : ""
// Author:Kilojin Date: 2005.02.14
// Modify History: //
environment env integer rtn rtn = GetEnvironment(env) IF rtn <> 1 THEN RETURN "" CHOOSE CASE env.OSType CASE Windows! // Windows 95 or 98 code return "Windows" CASE WindowsNT! // Windows NT-specific code return "WindowsNT" CASE Sol2! IF env.OSMinorRevision = 5 THEN RETURN "" ELSEIF env.OSMinorRevision = 6 THEN // Solaris 2.6 code RETURN "" END IF CASE ELSE RETURN "" END CHOOSE (责任编辑:admin) |