Click to See Complete Forum and Search --> : how to get filename


adesh
October 3rd, 2001, 11:19 PM
hai friends,

my application runs in ...
i opened my notepad.... clicked on open menu item it opens Open Dialog Box ... in that i selected filename and pressed Open pushbutton .. it is opened .... fine ...
but my question is that i would like to get the fullpath file name in my application ...
i am using hookings concept ...
i am getting the handle of the open dialog, that may useful for me to get fullpathfilename.

pl give example code or suggestions ...
waiting for reply ...

Cimperiali
October 4th, 2001, 09:25 AM
are you lookimg for this?

'The GetFullPathName function retrieves the full path and filename
' of a specified file.
'Requires Windows NT 3.1 or later; Requires Windows 95 or later

'example:

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()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
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("myfile.ext", 255, Buffer, "")
'remove the unnecessary chr$(0)'s
Buffer = Left(Buffer, Ret)
'show the result
MsgBox Buffer
End Sub





Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.

The Rater