elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.
 
Inicio Ayuda Ingresar Registrarse
06 Septiembre 2008, 01:13  



+  Foro de elhacker.net
|-+  Programación
| |-+  Programación VB (Moderadores: ||MadAntrax||, E0N)
| | |-+  SpecialFolderLocation (Source)
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Imprimir
Autor Tema: SpecialFolderLocation (Source)  (Leído 142 veces)
cobein

Desconectado Desconectado

Mensajes: 407



Ver Perfil WWW
SpecialFolderLocation (Source)
« en: 22 Abril 2008, 20:17 »

Hola, aca les dejo un snippet que muestra como obtener carpetas del sistema, no es nada nuevo pero este codigo esta rediucido y bastante optimizado.


Código
Option Explicit
 
Private Const CSIDL_SYSTEM As Long = &H25
 
Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As Long) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long
Private Declare Function PathAddBackslash Lib "shlwapi.dll" Alias "PathAddBackslashA" (ByVal pszPath As String) As Long
 
Private Function GetSpecialfolder(ByVal CSIDL As Long) As String
   Dim sPath   As String * 260
 
   If SHGetSpecialFolderLocation(0, CSIDL, CSIDL) = 0 Then
       If Not SHGetPathFromIDList(CSIDL, sPath) = 0 Then
           Call PathAddBackslash(sPath)
           GetSpecialfolder = Left$(sPath, lstrlen(sPath))
       End If
   End If
End Function
 
Private Sub Form_Load()
   Debug.Print GetSpecialfolder(CSIDL_SYSTEM)
End Sub
En línea

seba123neo

Desconectado Desconectado

Mensajes: 664



Ver Perfil WWW
Re: SpecialFolderLocation (Source)
« Respuesta #1 en: 22 Abril 2008, 20:42 »

si esta bueno,aca dejo algunas constantes de carpetas mas:

Código:
Private Const CSIDL_ADMINTOOLS As Long = &H30
Private Const CSIDL_ALTSTARTUP As Long = &H1D
Private Const CSIDL_APPDATA As Long = &H1A
Private Const CSIDL_BITBUCKET As Long = &HA
Private Const CSIDL_COMMON_ADMINTOOLS As Long = &H2F
Private Const CSIDL_COMMON_ALTSTARTUP As Long = &H1E
Private Const CSIDL_COMMON_APPDATA As Long = &H23
Private Const CSIDL_COMMON_DESKTOPDIRECTORY As Long = &H19
Private Const CSIDL_COMMON_DOCUMENTS As Long = &H2E
Private Const CSIDL_COMMON_FAVORITES As Long = &H1F
Private Const CSIDL_COMMON_PROGRAMS As Long = &H17
Private Const CSIDL_COMMON_STARTMENU As Long = &H16
Private Const CSIDL_COMMON_STARTUP As Long = &H18
Private Const CSIDL_COMMON_TEMPLATES As Long = &H2D
Private Const CSIDL_CONNECTIONS As Long = &H31
Private Const CSIDL_CONTROLS As Long = &H3
Private Const CSIDL_COOKIES As Long = &H21
Private Const CSIDL_DESKTOP As Long = &H0
Private Const CSIDL_DESKTOPDIRECTORY As Long = &H10
Private Const CSIDL_DRIVES As Long = &H11
Private Const CSIDL_FAVORITES As Long = &H6
Private Const CSIDL_FLAG_DONT_VERIFY As Long = &H4000
Private Const CSIDL_FLAG_MASK As Long = &HFF00&
Private Const CSIDL_FLAG_PFTI_TRACKTARGET As Long = CSIDL_FLAG_DONT_VERIFY
Private Const CSIDL_FONTS As Long = &H14
Private Const CSIDL_INTERNET As Long = &H1
Private Const CSIDL_HISTORY As Long = &H22
Private Const CSIDL_INTERNET_CACHE As Long = &H20
Private Const CSIDL_LOCAL_APPDATA As Long = &H1C
Private Const CSIDL_MYPICTURES As Long = &H27
Private Const CSIDL_NETHOOD As Long = &H13
Private Const CSIDL_NETWORK As Long = &H12
Private Const CSIDL_PERSONAL As Long = &H5
Private Const CSIDL_PRINTERS As Long = &H4
Private Const CSIDL_PRINTHOOD As Long = &H1B
Private Const CSIDL_PROFILE As Long = &H28
Private Const CSIDL_PROGRAM_FILES As Long = &H26
Private Const CSIDL_PROGRAM_FILES_COMMON As Long = &H2B
Private Const CSIDL_PROGRAM_FILES_COMMONX86 As Long = &H2C
Private Const CSIDL_PROGRAM_FILESX86 As Long = &H2A
Private Const CSIDL_PROGRAMS As Long = &H2
Private Const CSIDL_RECENT As Long = &H8
Private Const CSIDL_SENDTO As Long = &H9
Private Const CSIDL_STARTMENU As Long = &HB
Private Const CSIDL_STARTUP As Long = &H7
Private Const CSIDL_SYSTEM As Long = &H25
Private Const CSIDL_SYSTEMX86 As Long = &H29
Private Const CSIDL_TEMPLATES As Long = &H15
Private Const CSIDL_WINDOWS As Long = &H24

aunque al ser un numero Long directamente le haces un for del 1 al 60 y te las lista igual sin usar constantes...

saludos.
En línea

Todos somos ignorantes;lo que pasa es que no todos ignoramos las mismas cosas - Albert Einstein
Páginas: [1] Ir Arriba Imprimir 
Ir a:  







Consolas     La Web de Goku     MilW0rm     MundoDivx

Hispabyte     Truzone     TodoReviews     ZonaPhotoshop

hard-h2o modding    Foros de ayuda    Yashira.org    Videojuegos    indetectables.net   

Noticias Informatica    Seguridad Informática    ADSL    Foros en español    eNYe Sec

Todas las webs afiliadas están libres de publicidad engañosa.

Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC