当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 如何判断当前操作系统是否为98/2000/XP

ASP.NET
FreeTextBox(版本3.1.6)在ASP.Net 2.0中使用方法
.NET 常用功能和代码小结
在 .NET Framework 2.0 中未处理的异常导致基于 ASP.NET 的应用程序意外退出
asp.net IList查询数据后格式化数据再绑定控件
asp.net sql存储过程
asp.net 简单实现禁用或启用页面中的某一类型的控件
asp.net(c#)获取内容第一张图片地址的函数
The remote procedure call failed and did not execute的解决办法
ASP.NET 在线文件管理
asp.net 读取并修改config文件实现代码
ASP.NET Cookie 操作实现
asp.net Silverlight中的模式窗体
Silverlight中动态获取Web Service地址
asp.net Silverlight应用程序中获取载体aspx页面参数
asp.net 水晶报表隔行换色实现方法
asp.net 获取Gridview隐藏列的值
手动把asp.net的类生成dll文件的方法
asp.net 使用ObjectDataSource控件在ASP.NET中实现Ajax真分页
动态指定任意类型的ObjectDataSource对象的查询参数
asp.net Md5的用法小结

ASP.NET 中的 如何判断当前操作系统是否为98/2000/XP


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 54 ::
收藏到网摘: n/a

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