How To Get Application Path,And How To Get The Path's Directory,File Name,And Type Info(如何得到运行程序的路径,以及如何得到路径的文件夹,文件名,以及类型等等信息)

来源:互联网 发布:穿针引线软件下载 编辑:程序博客网 时间:2024/05/18 00:39
********************************************************************/
/* */
/* Function name : GetAppDir */
/* Description : Get application directory. */
/* */
/********************************************************************/
void GetAppDir(CString& strAppDir)
{
TCHAR szFullPath[MAX_PATH];
TCHAR szDir[_MAX_DIR];
TCHAR szDrive[_MAX_DRIVE];

// Get application's full path.
::GetModuleFileName(NULL, szFullPath, MAX_PATH);

// Break full path into seperate components.
_splitpath(szFullPath, szDrive, szDir, NULL, NULL);

// Store application's drive and path
strAppDir.Format(_T("%s%s"), szDrive, szDir);
}

原创粉丝点击