CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2001
    Posts
    9

    how to get filename

    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 ...



  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: how to get filename


    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: [email protected]
    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
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured