Ver Mensaje Individual
  #3  
Antiguo 13-06-2007
Avatar de seoane
[seoane] seoane is offline
Miembro Premium
 
Registrado: feb 2004
Ubicación: A Coruña, España
Posts: 3.717
Reputación: 26
seoane Va por buen camino
Y por si tienes el C oxidado

Código Delphi [-]
uses PsApi;

procedure EnumModules(List: TStringList);
var
  hMods: array[0..1024] of HMODULE;
  hProcess: THandle;
  Needed: DWORD;
  i: Integer;
  ModName: Array[0..MAX_PATH] of Char;
begin
  List.Clear;
  hProcess:= OpenProcess(PROCESS_QUERY_INFORMATION  or PROCESS_VM_READ,
    FALSE, GetCurrentProcessId);
  if hProcess <> 0 then
  begin
    if EnumProcessModules(hProcess, @hMods, Sizeof(hMods), Needed) then
      for i:= 0 to (Needed div Sizeof(HMODULE)) - 1 do
      begin
        FillChar(ModName,Sizeof(ModName),#0);
        if GetModuleFileNameEx(hProcess, hMods[i], ModName, Sizeof(ModName) - 1) <> 0 then
          List.Add(String(PChar(@ModName)));
      end;
    CloseHandle(hProcess);
  end;
end;

Por ejemplo:
Código Delphi [-]
var
  Lista: TStringList;
begin
  Lista:= TStringList.Create;
  try
    EnumModules(Lista);
    ShowMessage(Lista.Text);
  finally
    Lista.Free;
  end;
end;
Responder Con Cita