实现函数:

/
// 功能:返回程序所在文件夹的路径
/
CString CTestDlg::GetAppFolderPath()
{
	CString strAppPath; 
	::GetModuleFileName(NULL, strAppPath.GetBuffer(_MAX_PATH), _MAX_PATH); 
	strAppPath.ReleaseBuffer(); 

	int nPos = strAppPath.ReverseFind(_T('\\')); 
    strAppPath = strAppPath.Left(nPos + 1);

	return strAppPath;
}



示例:

获取程序所在的文件夹路径_api