当前位置:网站首页>MFC common current path
MFC common current path
2022-06-28 02:42:00 【Little yellow man software】
CString MyGetCurrentDirectory()
{
char chBuf[0x8000] = { 0 };
DWORD dwSize = GetEnvironmentVariable("path", chBuf, 0x10000);
if (dwSize == 0)
{
logger.INFO_F(FUN_LINE": GetEnvironmentVariable() fail....");
return 0;
}
logger.INFO_F(FUN_LINE": GetEnvironmentVariable() chBuf is: " + chBuf);
CString strEnvPaths(chBuf);
// find current path
if (!GetModuleFileName(NULL, chBuf, MAX_PATH)) // Software full path
{
logger.INFO_F(FUN_LINE": GetModuleFileName() fail....");
return 0;
}
logger.INFO_F(FUN_LINE": GetModuleFileName() chBuf is: " + chBuf);
CString strAppPath(chBuf);
const int nPos = strAppPath.ReverseFind(_T('\\'));
if (nPos > 0)
{
// add path backslash
strAppPath = strAppPath.Mid(0, nPos + 1); // current path
}
//des += "config.ini";
system("cd "+strAppPath); // And switch to the current path
return strAppPath;
//CString des = "";
//::GetCurrentDirectory(MAX_PATHLENGTH, des.GetBuffer(MAX_PATHLENGTH));
//des.ReleaseBuffer();
//des += "\\config.ini";
//return des;
}边栏推荐
- New choice for database Amazon Aurora
- 如何以数据驱动「客户全生命周期管理」,提高线索转化率及客户满意度?
- yarn下载报错There appears to be trouble with your network connection. Retrying.
- Cloud native (30) | kubernetes' app store Helm
- 数智学习|湖仓一体实践与探索
- How to realize red, green and yellow traffic lights in ros+gazebo?
- 贪吃蛇 C语言
- win11如何添加打印机和扫描仪?win11添加打印机和扫描仪的设置
- A set of sai2 brushes is finally finished! Share with everyone!
- SQL reported an unusual error, which confused the new interns
猜你喜欢

【历史上的今天】6 月 10 日:Apple II 问世;微软收购 GECAD;发明“软件工程”一词的科技先驱出生

MySQL优化小技巧

Complex and inefficient logistics? Three steps to solve problems in enterprise administration

后勤事务繁杂低效?三步骤解决企业行政管理难题

【历史上的今天】6 月 7 日:Kubernetes 开源版本发布;《魔兽世界》登陆中国;分组交换网络发明者出生

Mysql大合集,你要内容的这里全都有

Machine learning (x) reinforcement learning

MySQL collection, here are all the contents you want

【历史上的今天】6 月 23 日:图灵诞生日;互联网奠基人出生;Reddit 上线

Design e-commerce seckill system
随机推荐
Data governance and data standards
云平台kvm迁移本地虚拟机记录
【历史上的今天】6 月 17 日:术语“超文本”的创造者出生;Novell 首席科学家诞生;探索频道开播
Ionic4 realizes half star scoring
Keil "St link USB communication error" solution
Embedded must learn, detailed explanation of hardware resource interface -- Based on arm am335x development board (Part 1)
如何开启多语言文本建议?Win11打开多语言文本建议的方法
【历史上的今天】6 月 24 日:网易成立;首届消费电子展召开;世界上第一次网络直播
我今天忘带手机了
Leetcode topic [array] -228- summary interval
SQL injection bypass (V)
The system administrator has set the system policy to prohibit this installation. Solution
Opencv——霍夫变换以及遇到的一些问题
Dynamic Host Configuration Protocol
MySQL优化小技巧
MySQL optimization tips
flask基础:模板继承+静态文件配置
毕业总结
文件傳輸協議--FTP
一种低成本增长私域流量,且维护简单的方法