获取当前dll或者exe路径

elvinyang

关注

阅读 112

2022-04-08

**

更新时间: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)

0 0 举报