轉自:http://blog.csdn.net/norains/archive/2006/05/17/742948.aspx
//========================================================================
//TITLE:
// EVC獲取當前工作路徑
//AUTHOR:
// norains
//DATE:
// Wednesday 17-May-2006
//MARK:
// 非常感謝同事老張提供此段代碼!
//========================================================================
在EVC下沒有GetCurrentDirectory()這個函數能方便地獲取當前工作路徑,所以我們只能通過GetModuleFileName()函數的返回值來獲取當前的工作路徑.
//szPath:獲取的當前工作路徑
void GetCurrentDirectory(CString &szPath)
{
wchar_t pBuf[256];
GetModuleFileName(NULL,pBuf,sizeof(pBuf)/sizeof(wchar_t));
szPath=pBuf;
szPath = szPath.Left(szPath.ReverseFind('//')+1);
}