VB判断电脑是不是Vista操作系统

来源:百度知道 编辑:UC知道 时间:2024/06/16 06:46:46
不要太烦,直接判断Vista特有的文件是否存在来判断 我没装Vista

创建一个新窗体并添加 (Text 1 )一个文本框和一个命令按钮 (Command 1)。
将以下声明添加到 General Declarations 部分:
Declare Function GetVersion Lib "kernel32" () As Long

以下代码添加到命令按钮的 Click 事件:
Sub Command1_Click()
I& = GetVersion()

Windows& = I& And &HFFFF&
Dos& = (I& And &HFFFF0000) / 65536

' The low byte is derived by masking off high byte.
Lowbyte$ = Str$(Dos& And &HFF)
' The high byte is derived by masking off low byte and shifting.
Highbyte$ = LTrim$(Str$((Dos& And &HFF00) / 256))
' Assign MS-DOS version to Text property.
' Text1.Text = Highbyte$ + "." + Lowbyte$

Lowbyte$ = Str$(Windows& And &HFF)
' The high byte is derived by masking off low byte and shifting.
Highbyte$ = LTrim$(Str$((Windows& And &HFF00) / 256))
' Assign Windows version to Text property.

sysvr