看流星社区

 找回密码
 注册账号
查看: 1969|回复: 0

获取ATL Com组件所在的文件路径

[复制链接]

该用户从未签到

发表于 2013-5-19 10:38:14 | 显示全部楼层 |阅读模式
代码如下:

CHAR szPathOfComDll[MAX_PATH] = {0};
CStringA sPathOfDecode = "dllLpDecode.dll";
DWORD ret = GetModuleFileNameA(_AtlBaseModule.m_hInst, szPathOfComDll, MAX_PATH);
if (ret != 0) {
  CStringA s = szPathOfComDll;
  int iPos = s.ReverseFind('\\');
  sPathOfDecode = s.Left(iPos + 1) + sPathOfDecode;
}

如果GetModuleFileNameA函数的第一个参数填写NULL,一般找到的是EXE进程的路径。
点击按钮快速添加回复内容: 支持 高兴 激动 给力 加油 苦寻 生气 回帖 路过 感恩
您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

小黑屋|手机版|Archiver|看流星社区 |网站地图

GMT+8, 2024-5-15 18:57

Powered by Kanliuxing X3.4

© 2010-2019 kanliuxing.com

快速回复 返回顶部 返回列表