如何获取应用程序当前路径

来源:互联网 发布:昌龙网络 编辑:程序博客网 时间:2024/05/21 19:26

#include   <windows.h> 
char   fullPath[100]; 
 CString   strPath; 
 memset(fullPath,0,100); 
 GetModuleFileName(AfxGetInstanceHandle(),   fullPath,100);这句也可换成   GetModuleFileName(NULL,   fullPath,100) 
strPath=(CString)fullPath;   
int   position=strPath.ReverseFind('//');   //反向查找"/"所在的位置 
strPath=strPath.Left(position+1);  

 

 

更多技术文章请参看施昌权的个人网站: http://www.joyvc.cn

 

原创粉丝点击