工作总结:获取当前程序直接路径

代码:

CString GetConfDir()//获得路径 
{  
CString  sTemp;  CString sCurrentDir = "";  
char  lpszCurrentDir[MERGE_MAX_SIZE_OF_DIR_SEARCH_BUFF];

 ::GetModuleFileName( NULL,   lpszCurrentDir,   MERGE_MAX_SIZE_OF_DIR_SEARCH_BUFF);  //Get current directory 

 sCurrentDir = lpszCurrentDir;  
if (lpszCurrentDir[strlen(lpszCurrentDir) - 1] != '\\')  
{   
 sCurrentDir = sCurrentDir.Left(sCurrentDir.ReverseFind('\\') + 1); 
 } 
return sCurrentDir; 
}

 

posted @ 2014-04-01 21:36  CocoWang  阅读(173)  评论(0编辑  收藏  举报