当前位置:网站首页>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;
}边栏推荐
- 【历史上的今天】6 月 7 日:Kubernetes 开源版本发布;《魔兽世界》登陆中国;分组交换网络发明者出生
- SQL injection bypass (IV)
- 后勤事务繁杂低效?三步骤解决企业行政管理难题
- Is it safe for qiniu to open an account? How do I open an account online?
- Opencv——几何空间变换(仿射变换和投影变换)
- 把腾讯搬上云:云服务器 CVM 的半部进化史
- How to systematically learn LabVIEW?
- 文件传输协议--FTP
- 【模糊神经网络】基于matlab的模糊神经网络仿真
- 毕业季来临,2022届高校毕业生人数首次突破千万大关
猜你喜欢

数智学习|湖仓一体实践与探索

图灵机启动顺序

Architecture high reliability application knowledge map ----- microservice architecture map

The system administrator has set the system policy to prohibit this installation. Solution

【历史上的今天】6 月 17 日:术语“超文本”的创造者出生;Novell 首席科学家诞生;探索频道开播

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

How to use data-driven "customer lifecycle management" to improve lead conversion rate and customer satisfaction?

Opencv——霍夫变换以及遇到的一些问题

Teach you how to realize pynq-z2 bar code recognition

【历史上的今天】5 月 31 日:Amiga 之父诞生;BASIC 语言的共同开发者出生;黑莓 BBM 停运
随机推荐
Flutter 使用 CustomPaint 绘制基本图形
Shardingsphere-proxy-5.0.0 establish MySQL read / write separation connection (6)
【历史上的今天】6 月 3 日:微软推出必应搜索引擎;Larry Roberts 启动阿帕网;Visual Basic 之父出生
【电梯控制系统】基于VHDL语言和状态机实现的电梯控制系统的设计,使用了状态机
数据清洗工具flashtext,效率直接提升了几十倍数
SQL reported an unusual error, which confused the new interns
ROS+Gazebo中红绿黄交通灯如何实现?
KVM related
JS implementation of Slide Puzzle verification
STM32F103的11个定时器
【 amélioration de la correction d'image de Code bidimensionnel】 simulation du traitement d'amélioration de la correction d'image de Code bidimensionnel basée sur MATLAB
Stm32f1 and stm32subeide programming example - metal touch sensor driver
File transfer protocol --ftp
A low-cost method to increase private domain traffic with simple maintenance
Embedded must learn, detailed explanation of hardware resource interface -- Based on arm am335x development board (Part 1)
Win11不能拖拽图片到任务栏软件上快速打开怎么办
How to realize red, green and yellow traffic lights in ros+gazebo?
There appears to be a failure with your network connection Retrying.
Ionic4 realizes half star scoring
架构高可靠性应用知识图谱 ----- 架构演进之路