Declare Function GetVersion Lib"Kernel"() As
Integer 此函数没有参数,返回值为Windows的版本号,其中版本号的低位字节为Windows的主版本号,版本号的高位字节返回Windows的次版本号。判别过程如下:
Private Sub Form_Load () Dim ver As Integer Dim major As
Integer Dim minor As Integer Ver = GetVersion () major = ver And
&HFF minor = (ver And &HFF00) \ 256 If major <> 3 And minor
<> 10 Then MsgBox "版本不正确!" Exit Sub End If End
Sub
Function checkdir() As Boolean Dim windir As String * 200 Dim
winsys As String * 200 Dim winl As Integer Dim wins As
Integer Dim s1 As String Dim s2 As String winl =
GetWindowsDirectory(windir,200) winl =
GetSystemDirectory(winsys,200) s1 = Mid $(windir,1,winl) s2 = Mid
$(winsys,1,wins) If Wins = 0 Or wins = 0 Then checkdir =
False Exit Function End If If s1 <> "C:\WINDOWS" Or s2
<> "C:\WINDOWS\SYSTEM" Then checkdir = False Exit
Function End If checkdir = True End
Function