Results 1 to 4 of 4

Thread: Application Path [RESOLVED]

  1. #1

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125

    Application Path [RESOLVED]

    Resolved by other means

    I am using the following code which I found on this site to get the application filename and path, etc., but I want to just get the path so I can append "\mysql\setup.exe" to the end of it. What function can I use to strip the program's name off the end after the last '\\'?

    Code:
        char filename[MAX_PATH];
        GetModuleFileName(GetModuleHandle(NULL), filename, MAX_PATH);
        MessageBox(filename, "MasterSaw Installer", MB_OK);
    BTW, I am using MFC.

    Thanks.
    Last edited by MidgetsBro; Oct 7th, 2002 at 07:11 PM.
    <removed by admin>

  2. #2
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    This what you want
    PathRemoveFileSpec Function

    --------------------------------------------------------------------------------

    Removes the trailing file name and backslash from a path, if it has them.

    Syntax

    BOOL PathRemoveFileSpec( LPTSTR pszPath
    );
    Parameters

    pszPath
    [in, out] Pointer to a null-terminated string of maximum length MAX_PATH that contains the path from which to remove the file name.
    Return Value

    Returns nonzero if something was removed, or zero otherwise.


  3. #3

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    How do I include this in my project? I get this error:
    mastersawinstallerDlg.obj : error LNK2001: unresolved external symbol __imp__PathRemoveFileSpecA@4
    Debug/mastersawinstaller.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.
    Thanks for the response, I believe it is what I need.
    <removed by admin>

  4. #4
    Hyperactive Member made_of_asp's Avatar
    Join Date
    Jul 2001
    Location
    123 Fake Street
    Posts
    394

    Wink

    I think it's in shlwapi.lib and shlwapi.h
    VS.NET 2003

    Need to email me?

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