Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long Private Type OSVERSIONINFO dwOSVersionInfoSize As Long dwMajorVersion As Long dwMinorVersion As Long dwBuildNumber As Long dwPlatformId As Long szCSDVersion As String * 128 End Type Private Sub Form_Load() Dim OSInfo As OSVERSIONINFO, PId As String 'KPD-Team 1998 'URL: http://www.allapi.net/ '[email protected] 'Set the graphical mode to persistent Me.AutoRedraw = True 'Set the structure size OSInfo.dwOSVersionInfoSize = Len(OSInfo) 'Get the Windows version Ret& = GetVersionEx(OSInfo) 'Chack for errors If Ret& = 0 Then MsgBox "Error Getting Version Information": Exit Sub 'Print the information to the form Select Case OSInfo.dwPlatformId Case 0 PId = "Windows 32s " Case 1 PId = "Windows 95/98" Case 2 PId = "Windows NT " End Select Print "OS: " + PId Print "Win version:" + str$(OSInfo.dwMajorVersion) + "." + LTrim(str(OSInfo.dwMinorVersion)) Print "Build: " + str(OSInfo.dwBuildNumber) End Sub
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long Private Type OSVERSIONINFO dwOSVersionInfoSize As Long dwMajorVersion As Long dwMinorVersion As Long dwBuildNumber As Long dwPlatformId As Long szCSDVersion As String * 128 End Type Private Sub Form_Load() Dim OSInfo As OSVERSIONINFO, PId As String 'KPD-Team 1998 'URL: http://www.allapi.net/ '[email protected] 'Set the graphical mode to persistent Me.AutoRedraw = True 'Set the structure size OSInfo.dwOSVersionInfoSize = Len(OSInfo) 'Get the Windows version Ret& = GetVersionEx(OSInfo) 'Chack for errors If Ret& = 0 Then MsgBox "Error Getting Version Information": Exit Sub 'Print the information to the form Select Case OSInfo.dwPlatformId Case 0 PId = "Windows 32s " Case 1 PId = "Windows 95/98" Case 2 PId = "Windows NT " End Select Print "OS: " + PId Print "Win version:" + str$(OSInfo.dwMajorVersion) + "." + LTrim(str(OSInfo.dwMinorVersion)) Print "Build: " + str(OSInfo.dwBuildNumber) End Sub
判断目录下是否存在指定的文件:If Dir("c:\test\a.txt") <> "" Then MsgBox "文件存在" Else MsgBox "文件不存在" End If
API 声明: Public Declare Function GetVersion Lib "kernel32" Alias "GetVersion" () As Long判断当前操作系统的当前版本
在我的机器上没有发现这个路径:system\Iosubsys
win2k里没有system\Iosubsys XP不清楚
判断目录下是否存在指定的文件————不好用呀?像*.dll这样的隐藏属性是不是不起作用? 我明明把文件复制到这个C:\Wingdos\System\Iosubsys\smartvsd.vxd,可是,判断是没有。If Dir("C:\Wingdos\System\Iosubsys\smartvsd.vxd") <> "" Then MsgBox "文件存在" Else MsgBox "文件不存在" End If
If Dir("C:\Wingdos\System\Iosubsys\smartvsd.vxd", vbHidden + vbSystem + vbReadOnly) <> "" Then MsgBox "文件存在" Else MsgBox "文件不存在" End If
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Private Sub Form_Load()
Dim OSInfo As OSVERSIONINFO, PId As String
'KPD-Team 1998
'URL: http://www.allapi.net/
'[email protected]
'Set the graphical mode to persistent
Me.AutoRedraw = True
'Set the structure size
OSInfo.dwOSVersionInfoSize = Len(OSInfo)
'Get the Windows version
Ret& = GetVersionEx(OSInfo)
'Chack for errors
If Ret& = 0 Then MsgBox "Error Getting Version Information": Exit Sub
'Print the information to the form
Select Case OSInfo.dwPlatformId
Case 0
PId = "Windows 32s "
Case 1
PId = "Windows 95/98"
Case 2
PId = "Windows NT "
End Select
Print "OS: " + PId
Print "Win version:" + str$(OSInfo.dwMajorVersion) + "." + LTrim(str(OSInfo.dwMinorVersion))
Print "Build: " + str(OSInfo.dwBuildNumber)
End Sub
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Private Sub Form_Load()
Dim OSInfo As OSVERSIONINFO, PId As String
'KPD-Team 1998
'URL: http://www.allapi.net/
'[email protected]
'Set the graphical mode to persistent
Me.AutoRedraw = True
'Set the structure size
OSInfo.dwOSVersionInfoSize = Len(OSInfo)
'Get the Windows version
Ret& = GetVersionEx(OSInfo)
'Chack for errors
If Ret& = 0 Then MsgBox "Error Getting Version Information": Exit Sub
'Print the information to the form
Select Case OSInfo.dwPlatformId
Case 0
PId = "Windows 32s "
Case 1
PId = "Windows 95/98"
Case 2
PId = "Windows NT "
End Select
Print "OS: " + PId
Print "Win version:" + str$(OSInfo.dwMajorVersion) + "." + LTrim(str(OSInfo.dwMinorVersion))
Print "Build: " + str(OSInfo.dwBuildNumber)
End Sub
MsgBox "文件存在"
Else
MsgBox "文件不存在"
End If
Public Declare Function GetVersion Lib "kernel32" Alias "GetVersion" () As Long判断当前操作系统的当前版本
XP不清楚
我明明把文件复制到这个C:\Wingdos\System\Iosubsys\smartvsd.vxd,可是,判断是没有。If Dir("C:\Wingdos\System\Iosubsys\smartvsd.vxd") <> "" Then
MsgBox "文件存在"
Else
MsgBox "文件不存在"
End If
MsgBox "文件存在"
Else
MsgBox "文件不存在"
End If
FileCopy "c:\aa.txt", "d:\aa.txt"