'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
'@@@@@@@ S P E C I A L F O L D E R @@@@@@@@@@@@@@@@@@@@@@@@@@@@
'@@@@@@@ ó folder especiales (pero en ingles se escucha mejor) @@@@@@@@@@@@@@@@@@@@@@@@@@@@
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
'La declaración del API: (Special Folder)
Private Declare Function SHGetSpecialFolderPath Lib "shell32.dll" Alias "SHGetSpecialFolderPathA" _
(ByVal hWnd As Long, ByVal spath As String, _
ByVal Folder As Long, ByVal Create As Long) As Long
Sub SpecialFolder(ConsAPI, spath As String)
'La longitud máxima de un directorio puede ser 260
Const MAX_PATH = 260
'Algunas de las constantes
Const CSIDL_DESKTOP = 0
Const CSIDL_PROGRAMS = 2
Const CSIDL_STARTUP = 7
Const CSIDL_STARTMENU = 11
'Para usarla (la declaracion de la api)
'Dim spath1 As String
spath = String$(MAX_PATH + 1, 0)
Call SHGetSpecialFolderPath(Form1.hWnd, spath, ConsAPI, False)
'Quitarle el CHR$(0) del final
spath = Left$(spath, InStr(spath, Chr$(0)) - 1)
'MsgBox "El directorio XXXXX está en: " & vbCrLf & spath
End Sub
Private Sub Form_Load()
Me.AutoRedraw = True
Dim Text As String
For i = 1 To 50
Call SpecialFolder(i, Text)
Print i & " : ", , , Text
Next i
'sientate y analizalo, cualquier duda me preguntas
End Sub