Einzelnen Beitrag anzeigen

Popov
(Gast)

n/a Beiträge
 
#7

AW: Alle Units eines Projektes drucken

  Alt 20. Mär 2015, 18:49
Nur mal als Idee (schließlich bist du ein Programmierer):

Delphi-Quellcode:
uses
  ShellApi;

procedure GetFiles(Path, Ext: String; List: TStrings);
var
  SR: TSearchRec;
begin
  Path := IncludeTrailingBackslash(Path);

  if FindFirst(Path + '*.' + Ext, faAnyFile, SR) = 0 then
  repeat
    List.Add(Path + SR.Name);
  until FindNext(SR) <> 0;

  SysUtils.FindClose(SR);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  sl: TStringList;
  Path, Ext: String;
  i: Integer;
begin
  sl := TStringList.Create;
  try
    Path := ExtractFilePath(ParamStr(0));
    Ext := 'pas';

    GetFiles(Path, Ext, sl);

    for i := 0 to sl.Count - 1 do
      ShellExecute(0, 'open', 'NOTEPAD.EXE', PChar('/p ' + sl[i]), nil, SW_NORMAL);
  finally
    sl.Free;
  end;
end;
Wird zwar über Notepad ausgedruckt, aber wenn das kein Hindernis ist...
  Mit Zitat antworten Zitat