获取本应用程序exe名称

  • Post author:
  • Post category:其他



CString GetExeName()
{
	CString strTemp = "";
	TCHAR exeFullPath[_MAX_PATH];
	GetModuleFileName(NULL, exeFullPath, _MAX_PATH);
	strTemp = exeFullPath;

	int index = 0;
	while (true)
	{
		index = strTemp.Find("\\");
		if (index != -1)
		{
			strTemp = strTemp.Mid(index + 1);
		}
		else
		{
			break;
		}
	}
	CString strExeName = strTemp;
	return strExeName;
}



版权声明:本文为Jane_Yih原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。