⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 获得文件启动位置.txt

📁 可以获得文件执行程序的启动位置。 通过执行程序调用
💻 TXT
字号:
CString CFilePath::GetExecPath()
{//获得文件的启动位置
	CString cl = GetCommandLine();
	int count = cl.GetLength();
	int  lastY;//引号的位置
	lastY = cl.Find("\"", 1);
	//获得最后一个"\"的位置
	if(lastY > 0)
		cl = cl.Left(lastY);
	else
	{//找第一个空格的位置
		int space = cl.Find(" ", 0);
		if(space > 0) cl = cl.Left(space);
	}//
	int dash = -1;
	int temp;
	while(TRUE)
	{
		temp = cl.Find("\\", dash + 1);
		if(temp < 0) break;
		dash = temp;
	}
	if(dash == -1) return "";//为当前的路径的启动
	
	if(lastY > 0)
	{//存在引号
		//
		cl = cl.Left(dash);
		cl = cl.Right(cl.GetLength() - 1);//除掉第一个引号
		return cl;
	}
	else
		return cl.Left(dash);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -