当前位置:网站首页>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;
}边栏推荐
- MySQL collection, here are all the contents you want
- Step by step interpretation of crf+bilstm code
- Explanation of OSI layer 7 model (easy to understand in Chinese)
- High reliability application knowledge map of Architecture -- the path of architecture evolution
- CRF+BiLSTM代码分步骤解读
- Win11不能拖拽图片到任务栏软件上快速打开怎么办
- 【历史上的今天】6 月 6 日:世界 IPv6 启动纪念日;《俄罗斯方块》发布;小红书成立
- 迪赛智慧数——柱状图(折柱混合图):2021年毕业季租房价格和房租收入比
- flask基础:模板继承+静态文件配置
- ScheduledThreadPoolExecutor源码解读(二)
猜你喜欢

《低代码解决方案》——覆盖工单、维修和财务全流程的数字化售后服务低代码解决方案

迪赛智慧数——柱状图(折柱混合图):2021年毕业季租房价格和房租收入比

Win11如何关闭最近打开项目?Win11关闭最近打开项目的方法

How to realize red, green and yellow traffic lights in ros+gazebo?

Interpretation of bilstm-crf in NER forward_ algorithm

Embedded must learn, detailed explanation of hardware resource interface -- Based on arm am335x development board (Part 1)

【历史上的今天】6 月 19 日:iPhone 3GS 上市;帕斯卡诞生;《反恐精英》开始测试

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

【历史上的今天】6 月 2 日:苹果推出了 Swift 编程语言;电信收购联通 C 网;OS X Yosemite 发布

File transfer protocol --ftp
随机推荐
yarn下载报错There appears to be trouble with your network connection. Retrying.
SQL 注入绕过(四)
Cvpr22 collected papers | hierarchical residual multi granularity classification network based on label relation tree
技术人员如何成为技术领域专家
【历史上的今天】6 月 5 日:洛夫莱斯和巴贝奇相遇;公钥密码学先驱诞生;函数语言设计先驱出生
NER中BiLSTM-CRF解读Forward_algorithm
【历史上的今天】6 月 1 日:Napster 成立;MS-DOS 原作者出生;谷歌出售 Google SketchUp
SQL injection Bypass (2)
KVM相关
Dynamic Host Configuration Protocol
4G-learn from great partners
Teach you how to realize pynq-z2 bar code recognition
Learn pickle
JS implementation clock
关于st-link usb communication error的解决方法
General timer and interrupt of stm32
【历史上的今天】6 月 8 日:万维网之父诞生;PHP 公开发布;iPhone 4 问世
MySQL优化小技巧
MySQL optimization tips
From how to use to how to implement a promise