零贰'Blog

零贰'Blog - 记录日常点点滴滴..........

VC6取当前目录

代码学习VC6

1、

TCHAR szCurPath[MAX_PATH]; 
memset(szCurPath, 0, MAX_PATH); 
GetModuleFileName(NULL, szCurPath, sizeof(szCurPath)/sizeof(TCHAR));

2、

csSavePath=AfxGetApp()->m_pszHelpFilePath;
csSavePath=csSavePath.Left(csSavePath.GetLength()-4);
csSavePath = csSavePath + ".dat";

3、

CString csSavePath;
csSavePath=AfxGetApp()->m_pszHelpFilePath;
csSavePath=csSavePath.Left(csSavePath.ReverseFind('\\')+1);