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

Recoger en variable el path al escritorio

Estas en el tema de Recoger en variable el path al escritorio en el foro de Visual Basic clásico en Foros del Web. Salu2. Existe alguna forma de recoger en variable el path al escritorio ? muchas gracias....
  #1 (permalink)  
Antiguo 02/03/2007, 18:11
Avatar de sagutxo  
Fecha de Ingreso: octubre-2006
Mensajes: 78
Antigüedad: 17 años, 6 meses
Puntos: 0
Recoger en variable el path al escritorio

Salu2. Existe alguna forma de recoger en variable el path al escritorio ?
muchas gracias.
  #2 (permalink)  
Antiguo 02/03/2007, 18:27
 
Fecha de Ingreso: enero-2007
Ubicación: Tingo María - Perú
Mensajes: 399
Antigüedad: 17 años, 3 meses
Puntos: 13
Re: Recoger en variable el path al escritorio

Const CSIDL_DESKTOP = &H0
Const CSIDL_DESKTOPDIRECTORY = &H10
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 ShellAbout Lib "shell32.dll" Alias "ShellAboutA" (ByVal hWnd As Long, ByVal szApp As String, ByVal szOtherStuff As String, ByVal hIcon As Long) As Long
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 Sub Form_Load()
MsgBox "Desktop folder: " + GetSpecialfolder(CSIDL_DESKTOP)
End Sub
Private Function GetSpecialfolder(CSIDL As Long) As String
Dim r As Long
Dim IDL As ITEMIDLIST
'Get the special folder
r = SHGetSpecialFolderLocation(100, CSIDL, IDL)
If r = NOERROR Then
'Create a buffer
Path$ = Space$(512)
'Get the path from the IDList
r = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal Path$)
'Remove the unnecessary chr$(0)'s
GetSpecialfolder = Left$(Path, InStr(Path, Chr$(0)) - 1)
Exit Function
End If
GetSpecialfolder = ""
End Function
  #3 (permalink)  
Antiguo 02/03/2007, 18:41
Avatar de sagutxo  
Fecha de Ingreso: octubre-2006
Mensajes: 78
Antigüedad: 17 años, 6 meses
Puntos: 0
Re: Recoger en variable el path al escritorio

Salu2, muchísimas gracias, en cuanto me levante lo pruebo
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 03:48.