Foros del Web » Programación para mayores de 30 ;) » Programación General » Visual Basic clásico »

Obtener path de Mis Documentos

Estas en el tema de Obtener path de Mis Documentos en el foro de Visual Basic clásico en Foros del Web. Hola Se que debo usar las apis y llevo toda la tarde mirando getspecialfoder, shgetspecialfolder, SHGetPathFromIDList pero no doy con ello. Es fácil encontrar la ...
  #1 (permalink)  
Antiguo 02/07/2006, 12:49
 
Fecha de Ingreso: agosto-2003
Mensajes: 174
Antigüedad: 20 años, 9 meses
Puntos: 3
Obtener path de Mis Documentos

Hola
Se que debo usar las apis y llevo toda la tarde mirando getspecialfoder, shgetspecialfolder, SHGetPathFromIDList pero no doy con ello.

Es fácil encontrar la forma de ir al escritorio, a documentos recientes, al menú inicio, pero no veo la de 'mis documentos'. Yo creo que debe ser porque usa alguna contante que no la relaciono con ello´(así como DESKTOP -> Escritorio).

Un saludo
  #2 (permalink)  
Antiguo 02/07/2006, 21:47
Avatar de marcos1979  
Fecha de Ingreso: abril-2004
Ubicación: 62º 06' 18" O / 33º 07' 47" S
Mensajes: 331
Antigüedad: 20 años
Puntos: 1
Prueba con esto:

Código:
Const NOERROR = 0
Const CSIDL_DESKTOP = &H0
Const CSIDL_PROGRAMS = &H2
Const CSIDL_CONTROLS = &H3
Const CSIDL_PRINTERS = &H4
Const CSIDL_PERSONAL = &H5
Const CSIDL_FAVORITES = &H6
Const CSIDL_STARTUP = &H7
Const CSIDL_RECENT = &H8
Const CSIDL_SENDTO = &H9
Const CSIDL_BITBUCKET = &HA
Const CSIDL_STARTMENU = &HB
Const CSIDL_DESKTOPDIRECTORY = &H10
Const CSIDL_DRIVES = &H11
Const CSIDL_NETWORK = &H12
Const CSIDL_NETHOOD = &H13
Const CSIDL_FONTS = &H14
Const CSIDL_TEMPLATES = &H15
Const MAX_PATH = 260

Private Type SHITEMID
    cb As Long
    abID As Byte
End Type

Private Type ITEMIDLIST
    mkid As SHITEMID
End Type

Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long

Private Path As String

Private Function GetSpecialfolder(CSIDL As Long) As String
    
    Dim r As Long
    Dim IDL As ITEMIDLIST
    
    r = SHGetSpecialFolderLocation(100, CSIDL, IDL)
    
    If r = NOERROR Then
        Path = Space(512)
        r = SHGetPathFromIDList(IDL.mkid.cb, Path)
        GetSpecialfolder = Left(Path, InStr(Path, Chr(0)) - 1)
        Exit Function
    End If
    
    GetSpecialfolder = ""
    
End Function

    'Para la carpeta Mis Documentos
    MsgBox GetSpecialfolder(CSIDL_PERSONAL)
Un saludo
__________________
Marcos

El dinero no da la felicidad... démelo y sea feliz!!!
  #3 (permalink)  
Antiguo 03/03/2008, 00:26
 
Fecha de Ingreso: marzo-2008
Mensajes: 1
Antigüedad: 16 años, 2 meses
Puntos: 0
Re: Obtener path de Mis Documentos

Te paso un vinculo que si bien es para Python, la idea es leer el registry
http://flomana.spaces.live.com/blog/cns!3550E4D9E2BD3A98!869.entry

Salu2
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 20:28.