unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, AppEvnts;
type
TFRMMain =
class(TForm)
ApplicationEvents1: TApplicationEvents;
procedure doAppIdle(Sender: TObject;
var Done: Boolean);
private
procedure OpenRTFFile(
const AFileName:
String);
{ Private-Deklarationen }
public
procedure AfterConstruction;
override;
{ Public-Deklarationen }
end;
var
FRMMain: TFRMMain;
implementation
uses FRMText;
{$R *.dfm}
procedure TFRMMain.AfterConstruction;
begin
inherited;
Application.OnIdle := doAppIdle;
end;
procedure TFRMMain.OpenRTFFile(
const AFileName:
String);
Var
f : TTextForm;
begin
f := TTextForm.Create(Self);
f.Editor.Lines.LoadFromFile(AFileName);
f.Show;
end;
procedure TFRMMain.doAppIdle(Sender: TObject;
var Done: Boolean);
Var
i : Integer;
begin
Application.OnIdle :=
nil;
for i := 1
to ParamCount
do
if FileExists(ParamStr(i))
then
if UpperCase(ExtractFileExt(ParamStr(i))) = '
.RTF'
then
OpenRTFFile(ParamStr(i));
end;
end.