获取应用程序所在目录的方法

程序中经常要读取自身应用所在目录,用于读取配置文件等,这里介绍一种方法:

CString strINIFilePath;
GetModuleFileName(NULL,strINIFilePath.GetBuffer(MAX_PATH),MAX_PATH);
strINIFilePath.ReleaseBuffer();
CString path = strINIFilePath.Left(strINIFilePath.ReverseFind('\\') + 1);

 

posted @ 2016-07-19 10:39  jeffrey.chu  阅读(318)  评论(0编辑  收藏  举报

99code棋牌网