p; dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Public Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadId As Long
End Type
Public Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
Function StripTerminator(ByVal strString As String) As String
Dim intZeroPos As Integer
intZeroPos = InStr(strString, Chr$(0))
If intZeroPos > 0 Then
StripTerminator = Left$(strString, intZeroPos - 1)
Else
StripTerminator = strString
End If
End Function
'''' -----------------------------------------------------------
'''' 给目录添加分割线
''''
'''' -----------------------------------------------------------
''''
Sub AddDirSep(strPathName As String)
If Right(Trim(strPathName), Len(gstrSEP_URLDIR)) <> gstrSEP_URLDIR And _
Right(Trim(strPathName), Len(gstrSEP_DIR)) <> gstrSEP_DIR Then
strPathName = RTrim$(strPathName) & gstrSEP_DIR
End If
End Sub
'''' -----------------------------------------------------------
'''' 调用API函数获得Windows的系统目录
''''
'''' -----------------------------------------------------------
''''
Function GetWindowsSysDir() As String
Dim strBuf As String
strBuf = Space$(gintMAX_SIZE)
If GetSystemDirectory(strBuf, gintMAX_SIZE) > 0 Then
strBuf = StripTerminator(strBuf)
AddDirSep strBuf
GetWindowsSysDir = strBuf
Else
GetWindowsSysDir = vbNullString
End If
End Function
'''' -----------------------------------------------------------
'''' 调用API函数获取Windows目录
''''
'''' -----------------------------------------------------------
''''
Function GetWindowsDir() As String
Dim strBuf As String
strBuf = Space$(gintMAX_SIZE)
If GetWindowsDirectory(strBuf, gintMAX_SIZE) > 0 Then
strBuf = StripTerminator$(strBuf)
AddDirSep strBuf
GetWindowsDir = strBuf
Else
GetWindowsDir = vbNullString
End If
End Function
'''' --------------------------------------
'''' 测试目录是否存在
''''
'''' --------------------------------------
''''
Public Function DirExists(Path As String) As Boolean
On Error Resume Next
''''对于网络地址采用*.*形式
If InStr(Path, "\\") Then
DirExists = (Dir$(Path & "\*.*") <> "")
Else
DirExists = (Dir$(Path & "\nul") <> "")
End If
上一页 [1] [2] [3] [4] [5] 下一页 没有相关教程
|