Thread: GetFullPathName()?

  1. #1
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Question GetFullPathName()?

    I was using a listbox to nav. through dirs. It shows the DOS name, ex. - C:\PROGRA~1\somef~2.txt - I want the full name. How would I go about doing that with the path AND file name?
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: [email protected]

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  2. #2
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    LOL , I just had the same problem...

    You have to work with GetCurrentDirectory and SetCurrentDirectory. The params to those would be MAX_PATH + 1, and the buffer that you are reading/writing. Then, you can just get the filename from the LB_DIR listbox by:
    Code:
    i = SendMessage(hwndList, WM_GETCURSEL, 0, 0);
    SendMessage(hwndList, WM_GETTEXT, i, (LPARAM) szBuffer);
    This gets the filename. Then just lstrcat the filename onto the pathname buffer after you get the dir by calling GetCurrentDirectory.

    Garfield
    1978 Silver Anniversary Corvette

  3. #3
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Unhappy That's not what...

    That's not what I need. I need the FULL path name. Like if I hade the file - sometextfile.txt - in a listbox, it will show up something like - sometex~1.txt - but I need the full name along with path. How do I do that with GetFullPathName?
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: [email protected]

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  4. #4
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    So, your listbox is making the filename like this?
    1978 Silver Anniversary Corvette

  5. #5
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    SyntaxBubble, this shouldn't be a problem. You will be able to successfully open a file with the shortened notation. As long as the pathname is correct and the shortened filename is valid, it will be fine.

    Garfield
    1978 Silver Anniversary Corvette

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GetFullPathName
    By Moony in forum Windows Programming
    Replies: 3
    Last Post: 06-10-2007, 02:21 AM