您的位置:首页 > 其它

如何得到运行程序的路径,以及如何得到路径的文件夹,文件名,以及类型等等信息

2005-03-03 14:06 375 查看
********************************************************************/

/* */

/* 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);

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: