0
点赞
收藏
分享

微信扫一扫

获取当前dll或者exe路径

elvinyang 2022-04-08 阅读 112
c++

**

更新时间:2022-04-08

**

MFC获取当前dll路径(windows版本)

void getCurPath()
{
	CString path;	
	TCHAR curPath[MAX_PATH] = { 0 };
	GetModuleFileName(AfxGetInstanceHandle(), curPath, MAX_PATH);
	int index = CString(curPath).ReverseFind('\\');
	if (index > 0) 
	{
		path = CString(curPath).Left(index + 1);
	}
	return path;
}

输出:c:xx\xx\

举报

相关推荐

0 条评论