|
|
|
|
|
Dicas
|
|
Visual Basic (Arquivos/Diretórios)
|
|
|
Título da Dica: Abrir a caixa "Abrir diretório existentente" do windows
|
|
|
|
Postada em 11/2/2004 por PC
'****** COPIAR PARA UM MODULE **********
'Lembre-se as API resolvem de tudo!´o difícil é obter documentação :-( Public Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long Public Declare Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long Public Type SHITEMID 'mkid cb As Long abID As Byte End Type Public Type ITEMIDLIST 'idl mkid As SHITEMID End Type Public Type BROWSEINFO 'bi hOwner As Long pidlRoot As Long pszDisplayName As String lpszTitle As String ulFlags As Long lpfn As Long lParam As Long iImage As Long End Type
'******** COLOCAR NO EVENTO DO SEU BOTÃO OU MENU ******** Dim bi As BROWSEINFO Dim IDL As ITEMIDLIST Dim pidl As Long Dim r As Long Dim pos As Integer Dim sPath As String bi.hOwner = Me.hWnd bi.pidlRoot = 0& bi.lpszTitle = "Titulo" bi.ulFlags = BIF_RETURNONLYFSDIRS pidl& = SHBrowseForFolder(bi) sPath$ = Space$(512) r = SHGetPathFromIDList(ByVal pidl&, ByVal sPath$) If r Then pos = InStr(sPath$, Chr$(0)) MsgBox Left(sPath$, pos - 1) Else: Exit Sub End If
|
|
|
|
|