Visual Basic - llama carpeta del sistema

Life is soft - evento anual de software empresarial
 
Vista:

llama carpeta del sistema

Publicado por Gatito, maloz (6 intervenciones) el 29/07/2006 19:48:29
Hola Gente, necesito copiar un file en "Archivo de Programas" desde mi programita pero no se como identificar la carpeta del sistema ya que en todo ordenador no esta en la unidad C:\ . agradesería me des una pista de como hacer referencia a la dirección del sistema dond esta el operativo windos xp
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:llama carpeta del sistema

Publicado por LLE (7 intervenciones) el 30/07/2006 21:15:58
Hay una forma mas facil usando Environ y wshell pero no me acuerdo, esta es con el api:

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 Sub Form_Load()


MsgBox GetSpecialfolder(38)

End Sub
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(ByVal IDL.mkid.cb, ByVal Path$)

GetSpecialfolder = Left$(Path, InStr(Path, Chr$(0)) - 1)
Exit Function
End If
GetSpecialfolder = ""
End Function
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar