Visual Basic - OBTENER RUTA DEL ARCHIVO

Life is soft - evento anual de software empresarial
 
Vista:

OBTENER RUTA DEL ARCHIVO

Publicado por LEO (11 intervenciones) el 11/03/2006 17:59:08
HOLA
COMO PUEDO OBTENER LA RUTA DEL ARCHIVO DE VISUAL BASIC QUE ESTOY USANDO(LA TENGO QUE OBTENER CON UN CODIGO)
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:OBTENER RUTA DEL ARCHIVO

Publicado por Nicolas (97 intervenciones) el 11/03/2006 20:15:30
Mira este ejemplo sacado de la Api-Guide
Private Declare Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" (ByVal hModule As Long, ByVal lpFileName As String, ByVal nSize As Long) As Long
Private Declare Function GetWindowWord Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long) As Integer
Const GWW_HINSTANCE = (-6)
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Dim ModuleName As String, FileName As String, hInst As Long
'create a buffer
ModuleName = String$(128, Chr$(0))
'get the hInstance application:
hInst = GetWindowWord(Me.hwnd, GWW_HINSTANCE)
'get the ModuleFileName:
'enter the following two lines as one, single line:
ModuleName = Left$(ModuleName, GetModuleFileName(hInst, ModuleName, Len(ModuleName)))
'set graphics mode to persistent
Me.AutoRedraw = True
'show the module filename
Me.Print "Module Filename: " + ModuleName
End Sub
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

RE:OBTENER RUTA DEL ARCHIVO

Publicado por erque (38 intervenciones) el 12/03/2006 11:02:08
La ruta sin el nombre del archivo, por ejemplo con msgbox (App.Path).
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