|
-
Oct 7th, 2002, 04:43 PM
#1
Thread Starter
PowerPoster
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>
-
Oct 7th, 2002, 05:27 PM
#2
Frenzied Member
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.
-
Oct 7th, 2002, 05:39 PM
#3
Thread Starter
PowerPoster
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.
-
Oct 8th, 2002, 07:47 PM
#4
Hyperactive Member
I think it's in shlwapi.lib and shlwapi.h
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|