|
|
|
|
|
Dicas
|
|
Visual Basic (Arquivos/Diretórios)
|
|
|
Título da Dica: Múltiplas funções de pasta
|
|
|
|
Postada em 23/11/2003 por [_Chuck_]
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long Private Declare Function PathIsDirectory Lib "shlwapi.dll" Alias "PathIsDirectoryA" (ByVal pszPath As String) As Long
Public Enum TP_Dir [Windows] [System] [Temporario] End Enum
Public Function PegaPasta(TipoPasta As TP_Dir) As String Dim VL As String Select Case TipoPasta Case 0 VL = String(200, Chr$(0)) PegaPasta = Left$(VL, GetWindowsDirectory(VL, Len(VL))) Case 1 VL = Space(255) PegaPasta = Left$(VL, GetSystemDirectory(VL, 255)) Case 2 VL = String(100, Chr$(0)) GetTempPath 100, VL PegaPasta = Left$(VL, InStr(VL, Chr$(0)) - 1) End Select End Function
Public Function VerficaPastaExiste(Pasta As String) As Boolean If PathIsDirectory(Pasta) > 0 Then VerficaPastaExiste = True End If End Function
|
|
|
|
|