C#
string assemblyFolder =
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
EVC
wchar_t pBuf[256];
GetModuleFileName(NULL,pBuf,sizeof(pBuf)/sizeof(wchar_t));
szPath=pBuf;
szPath = szPath.Left(szPath.ReverseFind(’//’)+1);
本文介绍了一种使用C#和Windows API来获取当前运行程序所在文件夹路径的方法。通过System.IO和System.Reflection命名空间的功能,结合GetModuleFileName函数的应用,可以有效地得到程序的完整路径。
1万+

被折叠的 条评论
为什么被折叠?



