如何通过某个程序的句柄得到其路径,能不能实现,如何实现?请帮忙给个实现代码,谢谢了
解决方案 »
- 程序有2个timer,如果第一个忙的时候,第二个timer到时间触发吗?
- 使用VCLSKIN后的奇怪问题????
- 请问,如何用showmessage发送变量消息
- 又一个"Grid index out of range"提示......
- 问个送分的问题,
- 毕业答辩需要注意什么?参与者均有分!
- 怎样知道某数据集的计算字段事件完全执行完毕,需要在之后执行其他代码?
- InfoPower3000Std,InfoPower3000Pro,InfoPower3000Trial的序列号!
- 大写和自动记页数
- 如何获得SQL数据库中备注字段的内容?
- 一个TIdTcpClient控件的使用问题
- 如何用线程调用外部程序的时候,给他分配内存
EXE_Name, ModuleMainFileName:PChar; iLen: Integer): Integer;
//获得进程模块主文件名字(包含目录)
var
ModuleList :Thandle;
pm :TMODULEENTRY32;
begin
Result := 0;
ModuleList := CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, processID);
try
pm.dwSize := sizeof(TMODULEENTRY32);
if not module32first(ModuleList, pm) then Exit; if AnsiCompareText(Trim(pm.szModule), EXE_Name) = 0 then
begin
Result := length(ANSIString(pm.szexepath));
if (ModuleMainFileName <> nil) and (iLen > 0) then
StrLCopy(ModuleMainFileName, pm.szexepath, iLen);
Exit;
end;
while module32next(ModuleList, pm) do
begin
if AnsiCompareText(Trim(pm.szModule), EXE_Name) = 0 then
begin
Result := length(ANSIString(pm.szexepath));
if (ModuleMainFileName <> nil) and (iLen > 0) then
StrLCopy(ModuleMainFileName, pm.szexepath, iLen);
Exit;
end;
end;
finally
CloseHandle(ModuleList);
end;
end; // ModuleEnum