Mi servirebbe ottenere la stringa del percorso completo di un file.
In Vb di una maschera di access ad esempio vorrei ottenere il percorso del file .mdb corrente.
Ho provato con GetAbsolutePathName e GetCurrentDirectory, ma mi danno un percorso non completo.
Ponendo ad esempio un DB in: C:\Documents and Settings\Giovanni\documenti\Mia cartella\mio file.mdb il codice sotto mi dā: C:\Documents and Settings\Giovanni\documenti\mio file.mdb !
Perchč mi taglia \Mia cartella\ ?
Codice:
Private Declare Function GetFullPathName Lib "kernel32" Alias "GetFullPathNameA" (ByVal lpFileName As String, ByVal nBufferLength As Long, ByVal lpBuffer As String, ByVal lpFilePart As String) As Long
Private Sub Form_Load()
Dim Buffer As String, Ret As Long
'create a buffer
Buffer = Space(255)
'copy the current directory to the buffer and append 'myfile.ext'
Ret = GetFullPathName("mio file.Mdb", 255, Buffer, "")
'remove the unnecessary chr$(0)'s
Buffer = Left(Buffer, Ret)
'show the result
MsgBox Buffer
End Sub