搜索文章:

首页  |  Java技术  |  Asp.net  |  Asp编程  |  VC/C++  |  Delphi  |  VB编程

判断当前操作系统是否为98/2000/XP

方法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 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

()

相关文章:
© 2006   www.java-asp.net