请问如何通过查找窗口最终找到执行程序的路径和文件名?

kingtsui 2001-04-29 01:33:00
GetWindowModuleFileName在VC5里不能用,况且得到的只是执行模块的文件名,可能是exe也可能是dll
...全文
271 11 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
sxbyl 2001-04-30
  • 打赏
  • 举报
回复
GetWindowModuleFileName
elang 2001-04-30
  • 打赏
  • 举报
回复
关注一下
从WND到APP 的转换还是比较困难的
elang 2001-04-30
  • 打赏
  • 举报
回复

sxbyl(白菜)真是天才

UINT WINAPI GetWindowModuleFileName(
HWND hwnd,
LPTSTR lpszFileName,
UINT cchFileNameMax
);

Parameters
hwnd
Handle to the window whose module file name will be retrieved.
lpszFileName
Address of a string variable that will contain the executable file's path and file name.
cchFileNameMax
Value specifying the maximum number of characters to copy into the buffer at lpszFileName.
Return Values
Returns a value representing the total number of characters copied into the buffer
kingtsui 2001-04-29
  • 打赏
  • 举报
回复
不是调用的这个程序,是要得到别的程序的ModuleFileName
kingtsui 2001-04-29
  • 打赏
  • 举报
回复
补充一下,就是怎么把执行文件是指定的exe的所有正在运行的程序找出来,kill掉
vcbacker 2001-04-29
  • 打赏
  • 举报
回复
If this parameter is NULL, GetModuleFileName returns the path for the file used to create the calling process.
用NULL吧,
呵呵,我是照抄专家,:)
kingtsui 2001-04-29
  • 打赏
  • 举报
回复
DWORD GetModuleFileName(
HMODULE hModule, // handle to module
LPTSTR lpFilename, // file name of module
DWORD nSize // size of buffer
);

那么怎么得到hModule呢?
vcbacker 2001-04-29
  • 打赏
  • 举报
回复
executable file
vcbacker 2001-04-29
  • 打赏
  • 举报
回复
GetModuleFileName吧,老兄。
The GetModuleFileName function retrieves the full path and filename for the executable file containing the specified module.


vcbacker 2001-04-29
  • 打赏
  • 举报
回复
GetModuleFileName吧,老兄。
The GetModuleFileName function retrieves the full path and filename for the executable file containing the specified module.


kingtsui 2001-04-29
  • 打赏
  • 举报
回复
kao,问了两遍了都没人回啊!
都这么菜?!

16,547

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • AIGC Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧