Resumen Obtener el directorio "Mis Documentos"

Hola amigos,

Hace unos días pregunté si conocían una función me que devolviera la ruta que tiene el directorio de Documentos del Win95 (ej. "C:\Mis Documentos") ..... investigando y navegando encontré esta función que sí lo hace .... espero que les pueda ser útil.

Saludos, Alberto.

Private Declare Sub CoTaskMemFree Lib "ole32" (ByVal hPointer As Long)

Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal hIDL As Long, ByVal cPath As String) As Boolean

Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As Long) As Long

Function WinDocsDir() As String

  Const CISDL_PERSONAL = &H5



  Dim ItemIDList As Long

  Dim FolderPath As String * 260



  Dim retVal As Long

  ItemIDList = 0

  retVal = SHGetSpecialFolderLocation(Me.hWnd, CISDL_PERSONAL, ItemIDList)

  If retVal = 0 Then

    SHGetPathFromIDList ItemIDList, FolderPath

    CoTaskMemFree ItemIDList

    WinDocsDir = Trim$(FolderPath)

  Else

    WinDocsDir = ""

  End If

End Function

            +----------------------------+

    o__ | Alberto Perdomo | __o

a.perdomo@codetel.net.do
a.perdomo@usa.net



Resumen Resumen

Visual Basic Página de Visual Basic

Página principal Página principal

www.jrubi.com